What about ...
def update_something(value=false)
# ..
end
def after_save
update_something(true)
end
Or use instance variable as conditional state instead of passing
variable to a function called from macro (i.e after_save)
Arpit Jain wrote:
> I need to pass attributes to the function called in callback in rails
> model. For example,
>
> after_save :update_something
> after_destroy :update_something, true #true is the argument that I need
> to pass
>
> private
> def update_something(value = false)
> #...
> end
>
>
> I found a way to do it like this
>
> after_save :update_something
> after_destroy {|record| record.update_something(true)}
>
> But in this case, I need to make the function update_something public,
> which I don't want to do.
>
> Any help ?
>
>
> --
> Arpit Jain
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---