On Jul 24, 2007, at 7:30 PM, Pratik wrote:
> > Just starting a new thread so that it's easy to follow. > > I just submitted a patch at trac to add a new class method called > "set_default_values" ( not a great name I think ), which lets you do > all kinds of crazy stuff with setting default values. > > This ticket is at http://dev.rubyonrails.org/ticket/9093 and example > pastie is at http://pastie.caboo.se/81925 > > It also lets you make use of other attributes ( set by supplying > attributes to Model.new call or even those set by set_default_values > call ) in setter method/proc. > > If people like this approach, I'll add tests to patch, else will just > close the ticket :) i didn't see the switch, sorry! - why not instance_eval the so it's 'inside' initialize? seems a pain if you need a private method... - can't you avoid the 'skipped' business with self.class.default_values.keys - attributes.keys.map(&:to_s) looks awesome though. it will be very nice feature to have! i posted my fix here http://drawohara.tumblr.com/post/6677354 which i'm double posting (sorry) because the the thread switch. kind regards. a @ http://drawohara.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
