开发者

Understanding Rails helpers

开发者 https://www.devze.com 2023-03-15 07:34 出处:网络
I have two helper files. events_helper.rb and users_helper.rb. Both of these helper files have a method called foobar. In events controller, index view. If I cal开发者_如何学Pythonl foobar. Shouldn\

I have two helper files. events_helper.rb and users_helper.rb.

Both of these helper files have a method called foobar. In events controller, index view. If I cal开发者_如何学Pythonl foobar. Shouldn't it load the helper foobar thats in events_helper.rb?

Or is this not the way helpers work?


Seems like all helpers are available - so not sure which it would choose in your case, ideally the events controller one... and from your comment, it seems like its chosen the wrong one.

Could you give them distinct names?

Why are all Rails helpers available to all views, all the time? Is there a way to disable this?

0

精彩评论

暂无评论...
验证码 换一张
取 消