RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: aynulhabib
Just a heads up for those in Rails 4, I got stuck because of 1 thing:
the "find_or_create_by" method has been deprecated in rails 4
so instead of this
self.category = Category.find_or_create_by_name(name) if name.present?
self.category = Category.where(:name => name).first_or_create!
Hope that helps someone!