On May 12, 3:15 am, Nadal <[email protected]> wrote: > class User < AR > end > > user = User.new > > Let's say that I have a user instance with me. After this record is > saved I want an after_save callback which would print the id of the > record. > The only catch is that I am not allowed to change the User class. How > can I accomplish my goal? Is that even possible to add an after_save > callback on a particular instance object. Any metaprogramming hack. > I'm sure ruby does provide some tool.
well on top of what Colin says you can do def user.some_method end or user.extend SomeModule I think both will prevent you from marshalling the object and I seem to remember that in MRI both will cause ruby to dump it's cache of method names to implementations Fred > > This would be a trivial issue if I were allowed to change the User > class but I am not. > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

