On 24/07/07, Pratik <[EMAIL PROTECTED]> wrote: > > I would personally do it as something like : > > def initialize_with_defaults(attributes = nil, &block) > initialize_without_defaults(attributes) do > self.some_attribute = 'whatever' # Setting default value > yield self if block_given? > end > end > alias_method_chain :initialize, :defaults > > Looks like it's working quite well.
Except in the case where it overrides a value that's already been set by initialize_without_defaults. I'm not sure that's the behaviour you want. Plus, imitating the action of super by hand coding seems like a bit of a waste of time somehow. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
