Skip to content

Commit

Permalink
accept :scope option on hobo_index and hobo_index_for
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr authored and bryanlarsen committed Jan 19, 2010
1 parent 82e388b commit 7dc7f64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hobo/lib/hobo/model_controller.rb
Expand Up @@ -449,6 +449,8 @@ 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)
finder = Array.wrap(options.delete(:scope)).inject(finder) { |a, v| a.send(*Array.wrap(v).flatten) }

options[:order] = :default unless options[:order] || finder.send(:scope, :find)._?[:order]

if do_pagination
Expand Down

0 comments on commit 7dc7f64

Please sign in to comment.