Skip to content

Instantly share code, notes, and snippets.

@eclubb
Created April 8, 2011 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eclubb/910804 to your computer and use it in GitHub Desktop.
Save eclubb/910804 to your computer and use it in GitHub Desktop.
HABTM with deferred save error
class Category < ActiveRecord::Base
has_and_belongs_to_many_with_deferred_save :posts
end
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.5/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `before_save' for class `Category' (NameError)
from /usr/local/rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.5/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
from /usr/local/rvm/gems/ruby-1.9.2-p136/gems/has_and_belongs_to_many_with_deferred_save-0.2.0/lib/has_and_belongs_to_many_with_deferred_save.rb:89:in `has_and_belongs_to_many_with_deferred_save'
from /home/ehc/projects/dummy/app/models/category.rb:2:in `<class:Category>'
class Post < ActiveRecord::Base
has_and_belongs_to_many_with_deferred_save :categories
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment