Thanks by the tip!
On Sun, Jun 5, 2011 at 6:06 PM, Bill Walton
<bwalton.im-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Fernando,
>
> On Sun, Jun 5, 2011 at 3:59 PM, Fernando Aureliano
> <mail-7WGqr3rU1tU38Fpv8Ij67aBKnGwkPULj@public.gmane.org> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
*Fernando Aureliano*
--------------------------------------------------------------
[iOSDeveloper] - *ObjectiveC*
[WebDesigner] - *CSS3&HTML5*
*[WebDeveloper] - RubyOnRails*
*--------------------------------------------------------------
*
[portfolio] <http://www.fernandoaureliano.com> -
[blog]<http://www.fernandoaureliano.com/>
- [personal blog] <http://www.obsessivocompulsivo.com/> -
[twitter]<http://twitter.com/Pailoro>
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.