Permalink
Browse files

Merge pull request #80 from scambra/master

add inverse_of to associations
  • Loading branch information...
2 parents c2954b3 + a73bd99 commit 4a84a04f981b8584491c80cc9a8795e695ad1423 @parndt parndt committed Aug 1, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/awesome_nested_set/awesome_nested_set.rb
@@ -60,9 +60,11 @@ def acts_as_nested_set(options = {})
belongs_to :parent, :class_name => self.base_class.to_s,
:foreign_key => parent_column_name,
- :counter_cache => options[:counter_cache]
+ :counter_cache => options[:counter_cache],
+ :inverse_of => :children
has_many :children, :class_name => self.base_class.to_s,
- :foreign_key => parent_column_name, :order => quoted_left_column_name
+ :foreign_key => parent_column_name, :order => quoted_left_column_name,
+ :inverse_of => :parent
attr_accessor :skip_before_destroy
@@ -561,4 +563,4 @@ def quoted_scope_column_names
end
end
-end
+end

0 comments on commit 4a84a04

Please sign in to comment.