0
我對模型(「Stays」)實施了偏執狂,該模型正在開發中,但未在heroku上進行製作。在heroku網站上,我可以看到一個(預期爲空)索引頁面,但是當我去/停留/新時,我會看到一個錯誤頁面。「創建」與heroku上的紅寶石偏執狂無關
檢查日誌,我發現這一點:
2017-01-18T03:31:49.546164+00:00 app[web.1]: [d5ce2502-2cb9-4b1d-9888-f2990881bbb4] Completed 500 Internal Server Error in 16ms (ActiveRecord: 4.3ms)
2017-01-18T03:31:49.547115+00:00 app[web.1]: [d5ce2502-2cb9-4b1d-9888-f2990881bbb4] ActiveModel::UnknownAttributeError (unknown attribute 'deleted_at' for Stay.):
2017-01-18T03:31:49.547194+00:00 app[web.1]: [d5ce2502-2cb9-4b1d-9888-f2990881bbb4] app/controllers/stays_controller.rb:14:in `new'
在應用程序/控制器/ stays_controller.rb,這裏是第15行。
class StaysController < ApplicationController
before_action :set_stay, only: [:show, :edit, :update, :destroy]
before_action :correct_user, only: [:edit, :update, :destroy]
before_action :authenticate_user!, except: [:index, :show]
def index
@stays = Stay.all.order("created_at DESC")
end
def show
end
def new
@stay = current_user.stays.build #Stay.new
end
在Gemfile中:
gem 'paranoia', '~> 2.2'
在應用程序/模型/ stay.rb:
class Stay < ApplicationRecord
belongs_to :user
acts_as_paranoid
end
因爲我已經推到Heroku的運行heroku run rake db:migrate
,但沒有運氣。任何想法爲什麼這是在本地進行開發,而不是在heroku上進行生產?