Appendix D. A Catalog of Helper Methods
Everyone who has used Rails for a while has their own set of
“commonly used” helper methods. Many times, though, those commonly used
sets are different. Some people use FormHelper for all of their forms, while others
prefer FormTagHelper. Some people use
AssetTagHelper, while others handcode
links to static resources like stylesheets and images.
Rather than provide a comprehensive reference to these methods—the API documentation does that—this appendix provides a catalog you can browse to decide which methods might actually prove useful to your own needs. Much of the difficulty in using helpers is in finding them before you reinvent the wheel yourself.
All of these classes are subclasses of ActionView::Helpers.
Note
The easiest place to find API documentation, in a friendlier form than usual, is at http://rails-doc.org/. The search boxes give you choices as you type, and the explanations are presented in smaller pieces. You can also find the documentation at http://www.railsbrain.com/ and http://www.gotapi.com/rubyrails. They’re all a little different, but hopefully one of them will prove comfortable for you.
Calling Helper Methods
Every helper method has its own set of parameters, and often it’s not clear from the documentation which parameters it will accept. How do you interpret the following?
label(object_name, method, text = nil, options = {})The first few parameters at least take simple values. The object_name parameter will take a symbol pointing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access