possible to restrict a helper to a view?

Right now I have two controllers:


They each, of course, have their own helpers:


Is it possible to create a helper method with the same name in these
two helpers such that they are called by the corresponding view?

Basically I want:

<%= meets_on Schedule.find(:first) %> in courses/index.html.erb to
call meets_on in courses_helper.rb and

<%= meets_on Schedule.find(:first) %> in events/index.html.erb to
call meets_on in events_helper.rb.

I thought that's what would happen, but it turns out that the meets_on
method from events_helper.rb gets called all the time.

I could have sworn that helpers are unique to controllers too. To
test it, I created a new project from scratch with just two
controllers for courses and events that created two helpers
courses_helper.rb and events_helper.rb. I put in a very simple method
in each:

courses_helper.rb -
module CoursesHelper
  def my_helper
    "hello courses"

events_helper.rb -
module EventsHelper
  def my_helper
    "hello events"

Then in views/courses/index.html.erb I put in just one line -
<%= my_helper %>

Now when I go to http://localhost:3000/courses I see this:
hello events

Can someone tell me what I'm doing wrong? I put up the sample project
here -

The 3 files I mentioned above are here -

The whole project can be downloaded here -

Thanks for any help!

haha. thanks. it works now :slight_smile:

i guess i was thinking that something like this would be in
application_helper.rb but good to know!