I am working on a project that uses quite a bit of conditional logic
to display information about groups in a list. The partial that
renders the group attributes will display different info based on
whether the user is a) logged in, b) the creator of the group c) a
member of the group, etc.
I find myself using a lot of if/else conditions to render things as
they should be. The thing I dislike the most is that I'm writing the
same logic in different places. For instance, if a user is an admin
I'm doing:
<% if current_user.admin? %>
something...
<% end %>
...and I do that two or three times in the same template. What are
some other strategies. Can I use respond_to? How do people make
their view code more readable? If there are any good resources people
know about for this, please respond!
Thanks,
-A
--
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.