Blankman
Blankman

Reputation: 267020

Do helper classes get mixed into the controller?

If I have a homecontroller, will the home_helper.rb get mixed into the controller class?

I'm assuming so as it gets access to the request object somehow.

Upvotes: 1

Views: 135

Answers (1)

Sam 山
Sam 山

Reputation: 42863

No, helpers do not get mixed into controllers. You can hack rails but your best bet is to just include the method in application_helper.rb

This seems to be the best hack:

http://snippets.aktagon.com/snippets/47-Using-Rails-helpers-from-controllers-or-anywhere-you-want

Upvotes: 1

Related Questions