Hi Fernando, On Sun, Jun 5, 2011 at 3:59 PM, Fernando Aureliano <[email protected]> wrote: > Hi, > How I do a filter in a block of code? > example: > I have a block: > <% @notes[(0..3)].each do |note| %> <% if notes.type.class == String %> > <li> > <%= notes.note %> > <%= notes.type %> > </li> <% end %> > <% end %> > Type is a string, I would like to do a block filtering by a value on type.
However, your code will be much more testable if you do the filtering on @notes in the controller, or even better, by writing a method in your model that only returns records with type of class String. HTH, Bill -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

