You can use before_update_save from top controller and call rails methods to
get associated records. I used it on my application:
def before_save_create(record)
record.users.each do |user|
user.role_id = x
end
end
But if you have to call the associated controller method, i think you need
to create a static method on associated controller which you call it and
before_update_save on that controller also.
2009/6/16 cntrytwist <[email protected]>
>
> It appears that ActiveScaffold does not call the before_update_save/
> before_create_save callbacks for associations.
> What is the best way to make this happen?
> I have an association in which I need to set some fields on the
> associated record when it is created. The issue is that I don't know
> how to tell if the associated record is new or if it is just being
> updated. If ActiveRecord would issue the callbacks for the associated
> records, I'd be just fine.
> Please advise me of the best way to handle this.
> Thanks in advance.
> >
>
--
Regards,
Gabriel Sobrinho
E-mail: [email protected]
Phone: +55 31 8775 8378
Don't print this e-mail. The nature is thankful and your money also.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---