Module: Card::LookupQuery::ActiveRecordExtension

Defined in:
lib/card/lookup_query/active_record_extension.rb

Overview

support methods for sort and page

Instance Method Summary collapse

Instance Method Details

#paging(args) ⇒ Object



10
11
12
13
# File 'lib/card/lookup_query/active_record_extension.rb', line 10

def paging args
  return self unless valid_page_args? args
  limit(args[:limit]).offset(args[:offset])
end

#sort(hash) ⇒ Object



6
7
8
# File 'lib/card/lookup_query/active_record_extension.rb', line 6

def sort hash
  hash.present? ? sort_by_hash(hash) : self
end