开发者

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.

  1. form_for
  2. link_to
  3. image_tag
  4. stylesheet_link_tag
  5. javascript_include_tag
  6. content_for
  7. label_tag
  8. text_field_tag
  9. submit_tag
  10. select_tag
  11. options_for_select
  12. check_box_tag
  13. radio_button_tag
  14. form_tag
  15. collection_select

Some other useful ones as well:

  1. auto_link
  2. pluralize
  3. 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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜