Permalink
Browse files

Merge pull request #185 from ZenCocoon/fix_index

Display all model's attributes on index
  • Loading branch information...
seyhunak committed Apr 6, 2012
2 parents bab5e1c + 78b03f5 commit b169c3afa0bc57bd93e9bad0e7912ef211184e51
@@ -4,8 +4,8 @@
<thead>
<tr>
<th><%%= model_class.human_attribute_name(:id) %></th>
- <%- unless columns.empty? -%>
- <th><%%= model_class.human_attribute_name(:<%= columns.first.name %>) %></th>
+ <%- columns.each do |column| -%>
+ <th><%%= model_class.human_attribute_name(:<%= column.name %>) %></th>
<%- end -%>
<th><%%= model_class.human_attribute_name(:created_at) %></th>
<th><%%=t '.actions', :default => t("helpers.actions") %></th>
@@ -14,9 +14,9 @@
<tbody>
<%% @<%= plural_resource_name %>.each do |<%= resource_name %>| %>
<tr>
- <td><%%= <%= resource_name %>.id %></td>
- <%- unless columns.empty? -%>
- <td><%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %></td>
+ <td><%%= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %></td>
+ <%- columns.each do |column| -%>
+ <td><%%= <%= resource_name %>.<%= column.name %> %></td>
<%- end -%>
<td><%%=l <%= resource_name %>.created_at %></td>
<td>
@@ -4,17 +4,17 @@
%thead
%tr
%th= model_class.human_attribute_name(:id)
- <%- unless columns.empty? -%>
- %th= model_class.human_attribute_name(:<%= columns.first.name %>)
+ <%- columns.each do |column| -%>
+ %th= model_class.human_attribute_name(:<%= column.name %>)
<%- end -%>
%th= model_class.human_attribute_name(:created_at)
%th=t '.actions', :default => t("helpers.actions")
%tbody
- @<%= plural_resource_name %>.each do |<%= resource_name %>|
%tr
- %td= <%= resource_name %>.id
- <%- unless columns.empty? -%>
- %td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
+ %td= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
+ <%- columns.each do |column| -%>
+ %td= <%= resource_name %>.<%= column.name %>
<%- end -%>
%td=l <%= resource_name %>.created_at
%td
@@ -4,17 +4,17 @@ table class="table table-striped"
thead
tr
th= model_class.human_attribute_name(:id)
- <%- unless columns.empty? -%>
- th= model_class.human_attribute_name(:<%= columns.first.name %>)
+ <%- columns.each do |column| -%>
+ th= model_class.human_attribute_name(:<%= column.name %>)
<%- end -%>
th= model_class.human_attribute_name(:created_at)
th=t '.actions', :default => t("helpers.actions")
tbody
- @<%= plural_resource_name %>.each do |<%= resource_name %>|
tr
- td= <%= resource_name %>.id
- <%- unless columns.empty? -%>
- td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
+ td= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
+ <%- columns.each do |column| -%>
+ td= <%= resource_name %>.<%= column.name %>
<%- end -%>
td=l <%= resource_name %>.created_at
td

0 comments on commit b169c3a

Please sign in to comment.