Top 10-15 rails view helpers I should learn first?
I am learning rails 3, and want to know which view helpers I should master first?
i.e. which ones are us开发者_如何学Ced the most often?
1. form_for
2. ??
..
..
I think these are generally considered quite important and they should give you a great start to understanding code and creating forms and pages of your own.
- form_for
- link_to
- image_tag
- stylesheet_link_tag
- javascript_include_tag
- content_for
- label_tag
- text_field_tag
- submit_tag
- select_tag
- options_for_select
- check_box_tag
- radio_button_tag
- form_tag
- collection_select
Some other useful ones as well:
- auto_link
- pluralize
- simple_format
I would also work on understanding the difference between simply calling select_tag and calling f.select, where f is a form_for variable. These are generally the two different ways in which you create forms with helpers in Rails.
I would also make sure you understand the html_safe, raw and h functions for strings and displaying text on your page.
If you haven't already, read through the tutorial here:
http://edgeguides.rubyonrails.org/form_helpers.html
精彩评论