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 trialSeph Cordovano
17,400 PointsReceiving error due to outdated gem no longer being updated. How to proceed in this series?
With the state_machine gem not being updated anymore, what can those of do who are using newer versions of rails? Aside from scrapping our project and starting over with the versions matching those in these videos (I'm not even sure what versions are being used) since I'm using this to integrate friendships into an already existing project of mine.
I keep getting this in the rails console if I even attempt to touch the UserFriendship table. NoMethodError: undefined method `state_machine'
And if I do anything involving the friendship relationships in the app I get similar errors. undefined method `state_machine' for #<Class:0x007fed6aaab810>
Jason Seifer, any input?! Viva la Treehouse!
4 Answers
Maciej Czuchnowski
36,441 PointsTry aasm gem.
Seph Cordovano
17,400 PointsI actually went that route yesterday Maciej Czuchnowski but I can't seem to figure out how the syntax transfers over completely, especially in the user_friendship model. Did you complete this course with AASM? If so, would you mind showing what your user_friendship model and controller looks like?
Maciej Czuchnowski
36,441 PointsSure. My app is not exactly the same as the one on Treehouse, but I think the state machine works the same way:
https://github.com/mczuchnowski/treebook/blob/master/app/models/friendship.rb https://github.com/mczuchnowski/treebook/blob/master/app/controllers/friendships_controller.rb
Zach Ford
63 PointsMaciej Czuchnowski after having the same error with state_machine I switched to aasm. I keep getting an "uninitialized constant UserFriendship::AASM" After "include AASM" on my user friendship.rb - Everything is spelled correctly - Any clues?
Ben Wong
2,652 Points/Users/benwong/.rvm/gems/ruby-2.1.1/gems/activesupport-4.2.4/lib/active_support/core_ext/hash/keys.rb:75:in `block in assert_valid_keys': Unknown key: :conditions. Valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type (ArgumentError)
I got this error. Does it have to do with the fact that State Machine is not being supported for Rails 4?
Thanks,
Ben
Ben Wong
2,652 PointsAlright. Codes used in the video like "sources", and "conditions" are the culprit because State Machine is not supported in Rails 4.
mathias spurr
132 PointsBen Wong how did you solve it?