Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Yoochan Seo
305 Pointsrake db:setup failed due to undefined method 'statuses' for nil:NilClass
I have no ideas why it's failed, so here are my seeds.rb and the errors.
https://gist.github.com/geekerati/dfdac6530a058f9475b0
$ rake db:setup
db/development.sqlite3 already exists
db/test.sqlite3 already exists
-- create_table("statuses", {:force=>true})
-> 0.0082s
-- add_index("statuses", ["user_id"], {:name=>"index_statuses_on_user_id"})
-> 0.0013s
-- create_table("user_friendships", {:force=>true})
-> 0.0026s
-- add_index("user_friendships", ["state"], {:name=>"index_user_friendships_on_state"})
-> 0.0009s
-- add_index("user_friendships", ["user_id", "friend_id"], {:name=>"index_user_friendships_on_user_id_and_friend_id"})
-> 0.0010s
-- create_table("users", {:force=>true})
-> 0.0042s
-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
-> 0.0010s
-- add_index("users", ["profile_name"], {:name=>"index_users_on_profile_name", :unique=>true})
-> 0.0010s
-- add_index("users", ["reset_password_token"], {:name=>"index_users_on_reset_password_token", :unique=>true})
-> 0.0010s
-- add_index("users", ["username"], {:name=>"index_users_on_username", :unique=>true})
-> 0.0011s
-- initialize_schema_migrations_table()
-> 0.0002s
rake aborted!
NoMethodError: undefined method `statuses' for nil:NilClass
/Users/geekerati/Sites/wizmate/db/seeds.rb:69:in `<top (required)>'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/railties-4.0.0/lib/rails/engine.rb:540:in `load_seed'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/activerecord-4.0.0/lib/active_record/tasks/database_tasks.rb:153:in `load_seed'
/Users/geekerati/.rvm/gems/ruby-2.0.0-p353@rails-4.0.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:181:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
geekerati at Seoui-MacBook-Pro in ~/Sites/wizmate on master*
$
2 Answers
Ryan Vermotoen
4,262 PointsWhere have you defined statuses? Its saying that it doesn't know what the method statuses is, and is therefore failing. Go look where you have defined status and what type of definition you used.
Ryan Vermotoen
4,262 Points(so essentially, although your rake db:migrate is failing, the issue is not with your migrations, its that your migrations are pointing to a method (totally fine), but that method has not been defined(not totally fine, totally unfine)