Le 26 oct. 2014 à 18:34, Pier-Olivier Thibault <poth...@gmail.com> a écrit :
> With builtin' methods, there's many way to build this kind of HTML tag. And > I'm sure people here knows a few of them. However, none seem to really make > it easy to build them. So I decided to take a stab at it this weekend and > came up with this solution. > > <% for @posts.each do |post|%> > <%= content_tag :li, class: %w(post) do |li| %> > <% if post.id == 3 %> > <% li.css << 'selected' %> > <% end %> > post.title > <% end %> > <% end %> Hi, to me this solution doesn’t look cleaner, nicer, shorter than the example using inline test. I would use helpers to do this kind of things. — Nicolas Cavigneaux http://www.bounga.org http://www.cavigneaux.net -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.