[LRUG] Setting default roles in a user record

John Winters john at sinodun.org.uk
Tue Aug 7 08:06:40 PDT 2007


Tim Cowlishaw wrote:
> Hmm... thinking about it, wouldn't after_create do the job? i'm assuming 
> that after_initialize  is called whenever a new object of that class is 
> instantiated, whether through a new(), find() or whatever method on the 
> model. after_create is called after a new object of that class is 
> created through new().

As far as I can see from the documentation, after_create is invoked only 
*after* the record has been saved to the d/b.  This is quite late in the 
proceedings and too late to have the desired effect.

I want the new user record to appear on screen ready for editing with 
the two default roles already ticked.  That way the operator can choose 
to un-tick them if they're not appropriate.

I could almost do it with before_create, but it would mean things were 
happening behind the scenes which the operator didn't know about - not good.

John



More information about the Chat mailing list