2017-04-20 30 views
1

我創建了一個遷移就跑rake db:migrate的方法,但它說,它不存在。在我的IDE,它不給我一個錯誤,但它犯規保存在數據庫中無論是。它給了我Heroku上的生產版本的錯誤。Rails會不會發現我加

架構

create_table "reviews", force: :cascade do |t| 
    t.string "name" 
    t.text  "description" 
    t.integer "rating" 
    t.integer "user_id" 
    t.datetime "created_at", null: false 
    t.datetime "updated_at", null: false 
    t.text  "pros" 
    t.text  "cons" 
    t.string "category" 
    end 

表,視圖:https://hastebin.com/otisoqibon.js

<div class="field"> 
    <p class="flow-text">Category</p> 
    <%= f.text_field :category, :class => "grey lighten-2 autocomplete", :id => "autocomplete-input", %> 
    </div> 

控制器

def new 
    @review = Review.new 
    end 

錯誤

- 2017-04-20T01:49:22.051420+00:00 app[web.1]: 
    ActionView::Template::Error (undefined method `category' for): 
- 2017-04-20T01:49:22.051421+00:00 app[web.1]:  17: </div> 
- 2017-04-20T01:49:22.051423+00:00 app[web.1]:  19:  <p class="flow-text">Category</p> 
- 2017-04-20T01:49:22.051422+00:00 app[web.1]:  18: <div class="field"> 
    - 2017-04-20T01:49:22.051424+00:00 app[web.1]:  20:  <%= f.text_field :category, :id => "autocomplete-input", :class => "grey 
    lighten-2 autocomplete" %> 
    - 2017-04-20T01:49:22.051424+00:00 app[web.1]:  21: </div> 
    - 2017-04-20T01:49:22.051425+00:00 app[web.1]:  22: <div class="field"> 
    - 2017-04-20T01:49:22.051426+00:00 app[web.1]:  23:  <p class="flow-text">Pros, Woof Woof</p><br> 
+0

您好,您可以加入衆目睽睽文本?運行遷移後是否重新啓動了服務器? – Bohdan

+0

我重新啓動,但IM仍然得到錯誤:用'耙分貝重新啓動它 – bbousq

+0

嘗試'春stop':遷移:status'並請檢查是否它的狀態下** ** – mahemoff

回答

1

我想那是因爲你我以前不運行耙分貝:在Heroku遷移任務呢。

heroku run rake db:migrate