views:

31

answers:

0

When using the delegation feature of Ruby in Models:

class A
   def foo
   ...
   end

   def foo=(arg)
   ...
   end
end

class B < A
   belongs_to :a
   delegate :foo, :foo=, :to => :a
end

How can I force B to save A after setting b.foo="what_ever"? Oh and a.save should be called only if b.save is called and b.foo= was used - just to avoid unnecessary updates on a.