lib/scoped_finders.rb
# Paginated find with scope. See #find.
Paginated find with scope. See #find.
Paginated find with scope . See #find .
def paginate_with_scope( *args, &block )
      options = args.pop
      user = options.delete( :user )
      unless user.nil? || user.has_role?( 'admin' )
        with_scope( :find => { :conditions => [ 'user_id = ?', user.id ] } ) do
          paginate_without_scope( *args << options, &block )
        end
      else
        paginate_without_scope( *args << options, &block )
      end
    end
def paginate_with_scope ( * args , & block ) options = args . pop user = options . delete ( :user ) unless user . nil? || user . has_role? ( 'admin' ) with_scope ( :find => { :conditions => [ 'user_id = ?' , user . id ] } ) do paginate_without_scope ( * args << options , & block ) end else paginate_without_scope ( * args << options , & block ) end end
Paginated find with scope.
Paginated find with scope .
args
<not_specific>
block
<not_specific>