Ticket #964: scaffold_paginator.diff
| File scaffold_paginator.diff, 1.1 kB (added by mortonda@dgrmm.net, 4 years ago) |
|---|
-
controller.rb
old new 1 1 class <%= controller_class_name %>Controller < ApplicationController 2 model :<%= singular_name %> 3 2 4 <% unless suffix -%> 3 5 def index 4 6 list … … 12 14 13 15 <% end -%> 14 16 def list<%= suffix %> 15 @<%= plural_name %> = <%= model_name %>.find_all17 @<%= singular_name %>_pages, @<%= plural_name %> = paginate :<%= singular_name %>, :per_page => 10 16 18 end 17 19 18 20 def show<%= suffix %> -
view_list.rhtml
old new 1 1 <h1>Listing <%= plural_name %></h1> 2 2 <%%= link_to "Previous page", { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %> 3 <%%= link_to "Next page", { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %> 3 4 <table> 4 5 <tr> 5 6 <%% for column in <%= model_name %>.content_columns %>