How to create an after_save callback on runtime
Posted
by dorelal
on Stack Overflow
See other posts from Stack Overflow
or by dorelal
Published on 2010-05-10T17:55:48Z
Indexed on
2010/05/10
20:14 UTC
Read the original article
Hit count: 141
ruby-on-rails
I am using ruby on rails 2.3.5 .
I have user instance. On run time depending on certain conditions I want to add an after_save callback just for this instance.
The other issue is that this after_save should take a block or a proc as parameter.
What I want is something like this. This is psuedo code.
user = User.first
proc = Proc.new do puts 'this is foo' end
user.after_save proc
© Stack Overflow or respective owner