Pratik wrote:
>>  But, I would say that setting default values for model objects is an 
>> *extremely* common practice...
>> needed on just about every project.
> 
> Just wondering how did you achieve it previous to hearing about
> Jonathan's plugin ?
> 
> Why add a new callback when all you need is 4 lines of documentation
> on how to do it ?
> 
I do the after_initialize with an "if new_record?" in it... got that from a 
great post by Wes Gamble 
a while back where he outlined all the gotchas with setting default values. It 
was actually my 
impression from that post that one could *not* override initialize.

So, my point really is that needing to override after_initialize, but remember 
to put the check for 
a new_record in there (plus that fact that it's run on every load) is silly... 
and 
counter-intuitive. But, if overriding initialize is really completely safe and 
won't cause lots of 
heartache then fine. I'm not one to stampede to adding stuff to the framework.

I guess the question is, how bad a deal is it for people who miss the four 
lines of documentation 
versus how much of a change is to to provide a simple, obvious way to set model 
defaults. This is 
just one of those things that I need to explain to rails newcomers that seems 
silly and a bit 
embarrassing.

Anyway, I think I'll definitely check out Jonathan's plugin on my next app... 
looks all nice and 
"DSL-ish". :-)

Ben

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to