Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added will_paginate to index pages

  • Loading branch information...
commit 660fde216b2f81230f8a9198006c8806b31d2ad4 1 parent ce9143f
@ikanusim ikanusim authored
View
4 generators/scaffold_resource/templates/controller.rb
@@ -1,2 +1,6 @@
class <%= controller_class_name %>Controller < ResourceController::Base
+private
+ def collection
+ @collection = end_of_association_chain.paginate(:page => params[:page], :per_page => 15)
+ end
end
View
1  generators/scaffold_resource/templates/view_index.erb
@@ -17,6 +17,7 @@
</tr>
<%% end %>
</table>
+<%%= will_paginate @collection %>
<br/>
<%%= link_to 'New <%= singular_name.titleize %>', new_object_url %>
View
3  generators/scaffold_resource/templates/view_index.haml
@@ -14,6 +14,7 @@
%td= link_to 'Edit', edit_object_url(<%= singular_name %>)
%td= link_to 'Destroy', object_url(<%= singular_name %>), :confirm => 'Are you sure?', :method => :delete
+<%%= will_paginate @collection %>
%br/
-=link_to 'New <%= singular_name %>', new_object_url
+=link_to 'New <%= singular_name %>', new_object_url
Please sign in to comment.
Something went wrong with that request. Please try again.