开发者

Understanding Rails helpers

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜