Skip to content

Commit

Permalink
Added option per_page to crudify used in administration only
Browse files Browse the repository at this point in the history
  • Loading branch information
simi committed Mar 8, 2011
1 parent 56ac725 commit b1fa9fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/lib/refinery/crud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,14 @@ def paginate_all_#{plural_name}
paging_options = {:page => params[:page]}
# Use per_page from crudify options.
if #{options[:per_page]}
paging_options.update({:per_page => #{options[:per_page].inspect}})
# Seems will_paginate doesn't always use the implicit method.
if #{class_name}.methods.map(&:to_sym).include?(:per_page)
elsif #{class_name}.methods.map(&:to_sym).include?(:per_page)
paging_options.update({:per_page => #{class_name}.per_page})
end
@#{plural_name} = @#{plural_name}.paginate(paging_options)
end
Expand Down

0 comments on commit b1fa9fc

Please sign in to comment.