On Sunday, July 8, 2018 at 5:37:01 PM UTC+2, Joe Tseng wrote:
>
> I thought maybe it was because the version of RoR I had on Ubuntu (Ruby 2.5.1/Rails 5.2.0) was different than that on Windows (v2.3.3/v5.1.4). I explicitly locked my RoR versions to use what I had in Windows and then ran the migration - still the same error msg. Has anyone else encountered this before?
In the olden days migrations inherited straight from ActiveRecord::Migration. As the error message says, you now need to inherit from a version specific class (ActiveRecord::Migration[4.2], ActiveRecord::Migration[5.1]), depending on which version of Rails you were using when you wrote the migration. This makes it much easier for the rails team to introduce new behaviour to migrations in the future without breaking existing migrations. If it's a really old migration (ie it is already "included" in the schema.rb or database dumps you use) you might find it easier just to delete the old migrations rather than updating them all.
As an aside you are running rails 5.1.6, ie neither of the versions you mention, so perhaps there is something about that you haven't understood. The version your app uses should be specified in your Gemfile, (and then with the fully resolved dependencies in Gemfile.lock) so moving to a new machine shouldn't produce problems based on gem versions - bundler will install the same version of all the gems.
Fred
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3706fdf3-aaf5-454c-84b1-1f98ce8eb914%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment