I'm trying to upgrade an application to Rails 3 and I found a difference in the way helpers are loaded. I want to override a method based on the current controller but it now seems that all helpers are loaded.
I've broken it down to a simple example. I have a test app with 2 controllers - books and authors. In the BooksHelper module, I have:
module BooksHelper def some_helper "From books helper" end end
In AuthorsHelper module, I have:
module AuthorsHelper def some_helper "From authors helper" end end
In my index.html.erb for Books I include <%= some_helper %> and in index.html.erb for Authors I include the same <%= some_helper %>.
When I do the books index it shows as "From books helper" but when I do a authors index I get the same "From books helper" - I had hoped for "From authors helper". I tried the same app in rails 2 and I get the helper method from the current controller used - so I get what I expected.
In my real app - I have a call in the layouts - application.html.erb where I call the helper and hope to get the current controller's helper so I can show information (like bread crumbs) for the current controller.