aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb2
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml3
2 files changed, 4 insertions, 1 deletions
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
index b3190918bd..4959674976 100644
--- a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
+++ b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
@@ -12,7 +12,7 @@ class <%= controller_class_name %>Controller < ApplicationController
<% end -%>
def list<%= suffix %>
- @<%= plural_name %> = <%= model_name %>.find_all
+ @<%= singular_name %>_pages, @<%= plural_name %> = paginate :<%= singular_name %>, :per_page => 10
end
def show<%= suffix %>
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml
index 0ca1d1c97e..f30772b41b 100644
--- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml
+++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml
@@ -19,6 +19,9 @@
<%% end %>
</table>
+<%%= link_to "Previous page", { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %>
+<%%= link_to "Next page", { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %>
+
<br />
<%%= link_to 'New <%= singular_name %>', :action => 'new<%= suffix %>' %>