2010/5/7 Sergio Cambra .:: entreCables S.L. ::. <[email protected]>: > When you fill a subform, you are loading the parent controller, so methods > from > another controller can't be used. Anyway before_create_save and > before_update_save should be used only when you need something from session, > in other cases is better to use ActiveRecord's callbacks. In this case you > can: > > 1. To use :before_save in Trunk model to strip ip_addr: > before_save :strip_ip_addr > def strip_ip_addr > Utils.strip(self.ip_addr) > end > > 2. Override ip_addr= method in Trunk model: > def ip_addr=(value) > self[:ip_addr] = Util.strip(value) > end > > I prefer second way.
I'm realizing that I'll also need to execute some actions (XMLRPC requets) when creating/updating/deleting Trunk modesl, so perhaps in my case it's better to use the first approach and avoid AS creation/update callbacks. Thanks a lot. -- Iñaki Baz Castillo <[email protected]> -- 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.
