Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Jaime Young
Jaime Young
8,110 Points

Rails Console and other parts are not working?

Hi, to get the project up to speed. I downloaded your project and trashed my old one. When I tried running t.approve!, i get this error (below). // also a lot of things aren't working properly for me ever. Is it because I just downloaded your project or is it because of my gemset ? Or the compability of my rails and gems. ( currently using ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]

2.2.0@biller :003 > t.approve! NoMethodError: undefined method state' for #<TimeEntry:0x007fe042283690> from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/activemodel-4.0.3/lib/active_model/attribute_methods.rb:439:inmethod_missing' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/activerecord-4.0.3/lib/active_record/attribute_methods.rb:155:in method_missing' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/machine.rb:1092:inread' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/state_collection.rb:56:in match' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/state_collection.rb:80:inmatch!' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/event.rb:141:in transition_for' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/event.rb:171:infire' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/event.rb:247:in block in add_actions' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/machine.rb:765:incall' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/machine.rb:765:in block (2 levels) in define_helper' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/event.rb:252:inblock in add_actions' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/machine.rb:765:in call' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/state_machine-1.2.0/lib/state_machine/machine.rb:765:inblock (2 levels) in define_helper' from (irb):3 from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/railties-4.0.3/lib/rails/commands/console.rb:90:in start' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/railties-4.0.3/lib/rails/commands/console.rb:9:instart' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/railties-4.0.3/lib/rails/commands.rb:62:in <top (required)>' from bin/rails:4:inrequire' 2.2.0@biller :004 > t.state NoMethodError: undefined method state' for #<TimeEntry:0x007fe042283690> from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/activemodel-4.0.3/lib/active_model/attribute_methods.rb:439:inmethod_missing' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/activerecord-4.0.3/lib/active_record/attribute_methods.rb:155:in method_missing' from (irb):4 from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/railties-4.0.3/lib/rails/commands/console.rb:90:instart' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/railties-4.0.3/lib/rails/commands/console.rb:9:in start' from /Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/railties-4.0.3/lib/rails/commands.rb:62:in<top (required)>' from bin/rails:4:in require' from bin/rails:4:in<main>' 2.2.0@biller :005 >

1 Answer

Jaime Young
Jaime Young
8,110 Points

Currently doing stateful models tutorial in ruby on rails track by Hampton Caitlin

https://teamtreehouse.com/library/activerecord-basics/ar-extensions/stateful-models