query: tag:view
今回は、大げさな機能ではないですが、 知っているとちょっと便利なHelper関数を紹介します。 **cycle** まずはcycle。これはCSSのクラスに`even`, `odd`を指定する場合のような、 周期的に繰り返す文字列を簡単に埋め込むことが出来ます。 html>> @items = [1,2,3,4] <% @items.each do |item| %> "> <% end %>
item
<<-- **pluralize** 英語のみですが、数詞の語尾変化を適切に行ってくれます。 rails>> pluralize(1, 'person') # => 1 person pluralize(2, 'person') # => 2 people pluralize(3, 'person', 'users') # => 3 users pluralize(0, 'person') # => 0 people <<--
posted by genki genki on Mon 3 Mar 2008 at 15:29 with 0 comments