Em 20-06-2011 14:00, Jonathan Rochkind escreveu:
Thanks, I'll take a look at Redmine.
This was just an example. Redmine (nor Chiliproject) is not ported to
Rails 3 yet, so I listed it just to exemplify the kind of solution
you're looking for. I guess you won't be able to get some idea from its
source code...
ruby totally DOES support this though, and it often works. I'm not
sure what you're suggesting ruby doesn't support?
I'm talking about this:
module A
def some_method
1
end
end
module A # module reopening
def some_method
super * 2 # will raise an exception
end
end
This is different from
module SomeNamespacing
class A
def some_method
1
end
end
end
class A < SomeNamespacing::A
def some_method
super * 2
end
end
Rails totally adds all your helper modules into a master template
helper module using ruby 'include', it already does that, I wasn't
suggesting adding that design, that's the design that's already
there.
But Rails doesn't change Ruby behavior: it is just composition working
here...
And ruby certainly does support having multiple modules 'included'
into a given Module or Class, such that when the same method name
exists in both modules, the latter include'd one takes precedence, and
can still call 'super' to call up the chain...
Here, I may be wrong, but although I agree that the latest one will be
called, I don't think super will call the overridden method in the chain.
Cheers, Rodrigo.
--
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.