That's because Rails 3 implies helper :all.

https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5348-visibility-of-helpers-seems-all-wrong

On Mon, Oct 18, 2010 at 11:57 PM, Christopher G. <li...@ruby-forum.com>wrote:

> 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.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Erol M. Fornoles
http://erolfornoles.posterous.com
http://github.com/Erol
http://twitter.com/erolfornoles
http://ph.linkedin.com/in/erolfornoles

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to