jeudi 20 juillet 2017

rake db:migrate doesnt work after paperclip gem is installed

Hello guys im coding an instagram like app on rails, after i installed the paperclip gem (5.1) i created a model that i must migrate in the db. as i mentioned in the title the rake db:migrate doesnt work. i tried restarting the rails server and my laptop as suggested by some solutions, also tried adding the [5.1] next to the ActiveRecord::Migration like this as others suggested.

class CreatePics < ActiveRecord::Migration[5.1]

after changing some versions it still doesnt work. if its helpful the code project lies here http://ift.tt/2vmEN8a

the error i get is

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'

and goes on and on like this

Aucun commentaire:

Enregistrer un commentaire