On Wed, Mar 31, 2010 at 4:21 AM, Joshua Partogi <jpartogi@scrum8.com> wrote:
> This is what I wrote but it caused stack level too deep error:
>
> class FeatureObserver < ActiveRecord::Observer
> def before_update(feature)
> feature.send(:save)
> end
> end
:save precedes :update, so you've just created an infinite loop :-)
Try creating before_save, after_save, after_update methods in your
observer with some `puts` logging statements, and run in a console,
e.g.
>> feature.send(:update)
>> feature.send(:save)
and see what you get...
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment