--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Take a look at Apotomo (http://apotomo.de/) for an example of what I'm
talking about. Maybe that approach makes more sense than trying to
emulate some OO inheritance overriding methods in Modules through class
reopening and wanting to use "super" that way. Ruby doesn't support
that and I would recommend you to try another approach if your desired
results are something like Redmine's plugin system.
Cheers, Rodrigo.
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com.