On Jul 9, 10:50 pm, "recent convert = me"
<itsblakeith...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi out there. I am trying to create a table that displays
> information, and then changes the class of the row if a flag is
> presented, but can''t determine if putting it in the view is the
best
> method for doing so or not. Right now, I have tried this in my view,
> but it currently sets the columns to whichever is set into the if
> statements first.
>
> <% for widget in @widgets %>
> <% if widget.flag = "--" && widget.second_flag
= "--"%>
> <tr class="vgood">
Check your ruby: = is the assignment operator, == is the comparison
operator. You''d probably find this all flowed more naturally if you
wrapped this up in a view helper.
Fred
> <% elsif widget.flag = "++" || widget.second_flag =
"++"%>
> <tr class="bad">
> <% elsif widget.flag = "--" || widget.second_flag =
"--"%>
> <tr class="good">
> <%else%>
> <tr class="d<%= cycle("0",
"1") %>">
> <%end%>
>
> If anyone has any advice, I would be very appreciative.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---