NoMethodError: undefined method `[]' for #ActiveRecord::Migration:0x000000033fedc0
It seems you are using rails 4.2.
and versioned migration worked in rails 5 only
just remove [5.0]
from your migration and it will work fine.
like:
class UpdateUsers < ActiveRecord::Migration
def change
add_column(:users, :provider, :string, limit: 50, null: false, default: '')
add_column(:users, :uid, :string, limit: 500, null: false, default: '')
end
end
NoMethodError: undefined method `needs_migration?' for ActiveRecord::Migrator:Class
change your code to
if ActiveRecord::Base.connection.migration_context.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
Rails NoMethodError: undefined method `name' for #RecipeType:0x000055cd000b18a0:String
You seemed to have added the recipe_type
reference to the wrong table. Your last migration should probably have been
add_reference :recipes, :recipe_type, foreign_key: true
because as it is, you have added the reference_type reference to ReferenceType.
Why does my migration cause NoMethodError: undefined method `jsonb' for #ActiveRecord::ConnectionAdapters::MySQL::TableDefinition?
It looks like you are trying to do this with a sqlite
database in your local system, and sqlite
does not have json
support, try changing your database to either mysql
, postgres
or a database system that has json support.
Rails NoMethodError: undefined method `name' for #RecipeType:0x000055cd000b18a0:String
You seemed to have added the recipe_type
reference to the wrong table. Your last migration should probably have been
add_reference :recipes, :recipe_type, foreign_key: true
because as it is, you have added the reference_type reference to ReferenceType.
Related Topics
Instagram Ruby Gem - Unable to Reach Callback Url
Why Does Shoveling a String into a Hash Cause This Result
Adding Nested Attributes to Devise User Model
Routing Error During "Ruby on Rails-Tutorial"
Selenium Webdriver Take Screenshot of Viewport Only
How to Overwrite the '{ }' Object
Ruby: How to Process a CSV File with "Bad Commas"
With Nokogiri I am Getting Error "Initialize': Getaddrinfo: No Such Host Is Known. (Socketerror)"
How to Create Activerecord Style Validations Outside of Activerecord
How to Convert a Formatted String into Plain Text
Create and Initialize Instances of a Class with Sequential Names
Multiple Limit Condition in Mongodb
Nomethoderror: Undefined Method '[]' for #<Activerecord::Migration:0X000000033Fedc0>
Can You Append to Specific Elements in an Array Based on If Statement Conditions
Jekyll Custom Theme- Gemspec Bundle Install Error: Unexpected Unary-, Expecting Keyword_Do
Ruby/Watir/Rasta: Pass the Value from the Excel/Rasta to an Array in Ruby