Use reflection to show the list

Hi,
I have two list

  1. Groups that user part of
  2. Group members list.

I trying to do this by using the reflection so that I will be having
only one view in which depending on the action the object passed will be
different.

Is there any way to find the all attributes of the object so that I will
iterate on attributes array and list out the attribute values during
rendering?

Any help appreciated.

Thanks,
Tushar

Duno if it helps but

#view
<%= render :partial= “partials/values”, :collection => @values%>

#action
@values = Object.all

#_value.html.erb
<% value.attributes.each do |a| %>
<%= a.to_a[0] %>:
<%= a.to_a[1]>
<% end %>

[“crypted_password”, nil]
[“username”, nil]
[“password_salt”, nil]
[“persistence_token”, nil]
[“email”, nil]

Tushar G. wrote:

Hi,
I have two list

  1. Groups that user part of
  2. Group members list.

I trying to do this by using the reflection so that I will be having
only one view in which depending on the action the object passed will be
different.

Is there any way to find the all attributes of the object so that I will
iterate on attributes array and list out the attribute values during
rendering?

Any help appreciated.

Thanks,
Tushar