Listing users
<%= magic_grid(@basic_users, [:name, :email, :posts, 'Actions'],
:per_page => 10, :remote => true,
:top_pager => false, :bottom_pager => true) do |user| %>
<%= user.name %> |
<%= mail_to user.email %> |
<%= link_to user.posts.count, "/posts/by-user/#{user.id}" %> |
<%= link_to 'Show', user %>
<%= link_to 'Edit', edit_user_path(user) %>
<%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
|
<% end %>
<%= magic_grid( Array(1..1000), ["Number", "Word"], :per_page => 5) do |n| %>
<%= n %> |
<%= n.ordinalize %> |
<% end %>
<%= magic_grid(@optimized_users,
[{:sql => 'users.name', :label => 'Name'}, :email, :posts, 'Actions'],
:per_page => false,
:searchable => [0, 1]) do |user| %>
<%= user.name %> |
<%= mail_to user.email %> |
<%= link_to user.post_count, "/posts/by-user/#{user.id}" %> |
<%= link_to 'Show', user %>
<%= link_to 'Edit', edit_user_path(user) %>
<%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
|
<% end %>
<%= link_to 'New User', new_user_path %>