I'd like to state that this behaviour usually works in Ruby:
module A
end
module B
include A
end
A.module_eval do
def a
"Hey from A!"
end
end
Object.new.extend(B).a #=> "Hey from A!"
On Wednesday, June 27, 2012 6:43:00 PM UTC+2, Nick Sutterer wrote:
>
> Hi friends,
>
> I found a bug (?) with routes.url_helpers. Let's say my routes file
> contains
>
> resources :fruits
>
> Now I have the following setup:
>
> module A
> end
>
> module B
> include A
> end
>
> A.module_eval do
> include Rails.application.routes.url_helpers
> end
>
> Object.new.extend(A).fruit_path #=> That works.
> Object.new.extend(B).fruit_path #=> NoMethodError: undefined method
> `fruit_path' for #<Object:0x98e56d0>
>
> In a proper Ruby setup B should have references to any method in A.
> Obviously, this doesn't work with url_helpers. I didn't check its
> implementation so far, is there any magic done inside the url_helpers that
> breaks the expected behaviour?
>
> Nick
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/XbjtmqCrsOQJ.
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.