We are creating a website for creating and maintaining communities. When
members of a community are listed, we show their summary in a TABLE. So
we have written a _member.rhtml partial to show this summary for that
member. To show the memberlist we do
render :partial => member, :collection => @members
Now the problem is the row displayed for every member by the _member
partial, may differ depending on the context. For instance, if we are
listing them under a community, we want to show a BLOCK button next to
each member, to allow the user to block other members from that
community. When displaying members in a general list, not under a
community, we want to show an INVITE button against every member to add
him as a friend in the user’s Friends list.
There are a number of other cases, wherein the buttons or additional
info shown for each member is different depending on the context.
In such cases how do we code the _member partial to take care of all
different possible ways to show a member?
In general is there a guideline on how to make sure we Don’t Repeat
Ourselves?
-Yash