I have a shared partial in
-shared
└──-foo
└──-bar
└──baz.html.erb
And in it I'm trying to access a helper method in
-helpers
└──foo_helper.rb
But I am getting un undefined method
error.
How can I include that helper method in my partial in an elegant way?
Put
helper :foo
in your application controller. This should make the helpers in foo_helper available across all actions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.