We don’t allow questions seeking recommendation开发者_开发百科s for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this questionI may be blind but I can't really find any good documentation on how to write helpers for your own views in rails 3. The kind of answers I'm looking for is:
I have a partial view (say shared/_error_messages.html), where should its helper go, how should I name it, which are the conventions? How to pass local variables from the view to the helper and vice-versa?
Yeap, so let's say from the basics... Thanks in advance
Extract the method from _error_messages.html.erb to helpers/application_helper.html.erb, this is a global helper, which means the methods there are available in the whole project.
You could leave it as a partial and load it with
<%= render :partial => "shared/error_messages" %>
as well.
精彩评论