nahabed wrote:> I am building a app for trading books where a user lists books that
> they want to trade and those then want to get.
>
> I have a Book model with title, author and condition as attributes.
> The "condition" attribute (good, fair, poor) is set by the user
for
> the books they have to trade when the item is listed. This attribute
> is not set for books that a user is looking to get. A "list"
method
> displays all the books as follows:
>
> <% for column in Book.content_columns %>
> <p>
> <b><%= column.human_name %>:</b> <%=h
@book.send(column.name) %>
> </p>
> <% end %>
>
> What I am looking for is a way NOT to display the "condition"
field
> when dealing with books that I "want" but not for the other.
What''s a
> good way to do that in the view in the "for" loop above?
>
> Thanks, Roupen N.
To tell the truth , i didn''t take what you meant, but i guess sth...
<% for column in Book.content_columns %>
<% unless column.name == "condition" &&
@book.is_looking_to_get%>
<p>
<b><%= column.human_name %>:</b> <%=h
@book.send(column.name) %>
</p>
<% end %>
<% end %>
try this
contact me and make a friend ^^
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---