On Martes, 29 de Septiembre de 2009 08:54:18 helmerj escribió: > Hi, > > I read the docs and googled all over the place but I could not find a > way to preinitialize a create form field using active scaffold. > > I have a number filed in a model and I would like to get the number of > the last record add one and initialize the number field of my create > view with it. > > I am sure there must be a way using a controller entry and a field > override. All my attempts didn't work though... > > I'd appreciate any pointers
You can override do_new and set in @record what you want to show as default values. def do_new super @record.your_column = your_value other custom code end > > Cheers J. > -- Sergio Cambra .:: entreCables S.L. ::. Mariana Pineda 23, 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [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 -~----------~----~----~----~------~----~------~--~---
