Skip to content

Commit

Permalink
Model controller - don't set :order => :default if there is already a…
Browse files Browse the repository at this point in the history
…n ordering
  • Loading branch information
tslocke committed Jul 7, 2008
1 parent d1a4bb7 commit 3ad35f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hobo/lib/hobo/model_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,11 @@ def request_requires_pagination?
def find_or_paginate(finder, options)
options = options.reverse_merge(:paginate => request_requires_pagination?)
do_pagination = options.delete(:paginate) && finder.respond_to?(:paginate)
options[:order] = :default unless options[:order] || finder.send(:scope, :find)[:order]

if do_pagination
finder.paginate(options.reverse_merge(:page => params[:page] || 1, :order => :default))
options.reverse_merge!(:page => params[:page] || 1)
finder.paginate(options)
else
finder.all(options)
end
Expand Down

1 comment on commit 3ad35f3

@magicseth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 362,

finder.send(:scope, :find)

returns nil on index pages for me.

Please sign in to comment.