0
你好傢伙編碼在軌道上的instagram像一個Instagram的應用程序,我安裝回形針寶石(5.1)後,我創建了一個模型,我必須在數據庫中遷移。正如我在標題中提到的rake db:migrate不起作用。按照某些解決方案的建議,我嘗試重新啓動rails服務器和我的筆記本電腦,並嘗試像其他人建議的那樣,在ActiveRecord :: Migration旁邊添加[5.1]。耙db:遷移不起作用後,回形針寶石安裝
class CreatePics < ActiveRecord::Migration[5.1]
更改某些版本後,它仍然無法正常工作。 如果有用的代碼項目就在這裏https://github.com/leobouts/Instagramm
我得到的錯誤是
rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:
class AddAttachmentImageToPics < ActiveRecord::Migration[4.2]
/Users/leonidas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.2/lib/active_record/migration.rb:525:in `inherited'
/Users/leonidas/Desktop/Instagramm/db/migrate/20170719181859_add_attachment_image_to_pics.rb:1:in `<top (required)>'
/Users/leonidas/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
,並繼續和這樣
你應該在這裏包括AddAttachmentImageToPics遷移 –
我猜的版本號遷移類如你使用Rails 3只在Rails的5加,你應該沒有版本號的類名。嘗試將其更改爲'類CreatePics
Pavan
我建議你重置你的數據庫:rake db:reset – Snake