1、清单的背景颜色是交替变化的,为了完成这样,Rails的帮助函数cycle通过将每行的CSS类设置为:list_line_wven或list_line_odd。
eg。<tr class="<%= cycle('list_line_odd' , 'list_line_even')">..</tr>
2、truncate这个函数用来显示描述字段的前80个字符。但在调用之前truncate之前,需要调用函数strip_tags取出描述字段中的HTML标签
eg。<%= truncate(strip_tags(product_incoudus) , :length => 80 ) %>
3、图片标签:<% =image_tag(product.imqge_url , :class=>'list_image')%>
4、是否属于一个有效数字:greater_than_or_equal_to
eg.validates:prices ,:numericality => {"greater_than_or_equal_to => 0.01}