Skip to content

Commit

Permalink
Ensure :per_page has a default value and that it will either evaluate…
Browse files Browse the repository at this point in the history
… to true or false not, say, 20.
  • Loading branch information
parndt committed Mar 9, 2011
1 parent 5ace097 commit c4def61
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
refinerycms (0.9.9.6)
bundler (~> 1.0.10)
bundler (~> 1.0)
refinerycms-authentication (~> 0.9.9.5)
refinerycms-base (~> 0.9.9.5)
refinerycms-core (~> 0.9.9.5)
Expand Down
5 changes: 3 additions & 2 deletions core/lib/refinery/crud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def self.default_options(model_name)
:include => [],
:paging => true,
:search_conditions => '',
:redirect_to_url => "admin_#{plural_name}_url"
:redirect_to_url => "admin_#{plural_name}_url",
:per_page => false
}
end

Expand Down Expand Up @@ -162,7 +163,7 @@ def paginate_all_#{plural_name}
paging_options = {:page => params[:page]}
# Use per_page from crudify options.
if #{options[:per_page]}
if #{options[:per_page].present?.inspect}
paging_options.update({:per_page => #{options[:per_page].inspect}})
# Seems will_paginate doesn't always use the implicit method.
elsif #{class_name}.methods.map(&:to_sym).include?(:per_page)
Expand Down

0 comments on commit c4def61

Please sign in to comment.