After successfully ran rake db:migrate
, trying to run rake db:seed --trace
but getting peculiar error NoMethodError: undefined method 'name' for nil:NilClass
.
Not exactly sure what the issue is. Any advice would be greatly appreciated. Thanks!!
/usr/local/bundle/gems/activerecord-4.1.1/lib/active_record/associations/has_many_association.rb:74: warning: circular argument reference - reflection
/usr/local/bundle/gems/activerecord4.1.1/lib/active_record/associations/has_many_association.rb:78: warning: circular argument reference - reflection
/usr/local/bundle/gems/activerecord4.1.1/lib/active_record/associations/has_many_association.rb:82: warning: circular argument reference - reflection
/usr/local/bundle/gems/activerecord4.1.1/lib/active_record/associations/has_many_association.rb:101: warning: circular argument reference - reflection
rake aborted!
NoMethodError: undefined method `name' for nil:NilClass
/usr/local/bundle/gems/activerecord-4.1.1/lib/active_record/associations/has_many_association.rb:79:in `cached_counter_attribute_name'
/usr/local/bundle/gems/activerecord-4.1.1/lib/active_record/associations/has_many_association.rb:75:in `has_cached_counter?'
/usr/local/bundle/gems/activerecord-4.1.1/lib/active_record/associations/has_many_association.rb:83:in `update_counter'
/usr/local/bundle/gems/activerecord-4.1.1/lib/active_record/associations/has_many_through_association.rb:65:in `insert_record'
/usr/local/bundle/gems/activerecord-4.1.1/lib/active_record/associations/collection_association.rb:522:in `block (2 levels) in concat_records'
#db/seeds.rb
APP_KEYWORDS = YAML.load_file("#{Rails.root}/db/app_keywords.yml")
User.create(email: 'name@name.com', password: 'passwrd', password_confirmation: 'passwrd')
User.create(email: 'name@name.com', password: 'psswrd', password_confirmation: 'psswrd')
User.create(email: 'name@name.com', password: 'password', password_confirmation: 'password')
User.create(email: 'name@name.com', password: 'password', password_confirmation: 'password')
APP_KEYWORDS["app"].each do |key,value|
app = App.find_or_create_by(name:key.downcase)
value.each do |val|
app.app_keywords.find_or_create_by(keyword:val.downcase)
end
end
["admin","moderator","venue_editor","user"].each do |role|
Role.find_or_create_by(name:role)
end
user = User.first
user.add_role :admin
Following the issue: https://github.com/activescaffold/active_scaffold/issues/380
Try update for rails 4.1.2 version
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.