Class: ForestLiana::ResourcesGetter

Inherits:
Object
  • Object
show all
Defined in:
app/services/forest_liana/resources_getter.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource, params) ⇒ ResourcesGetter

Returns a new instance of ResourcesGetter.



3
4
5
6
# File 'app/services/forest_liana/resources_getter.rb', line 3

def initialize(resource, params)
  @resource = resource
  @params = params
end

Instance Method Details

#countObject



18
19
20
# File 'app/services/forest_liana/resources_getter.rb', line 18

def count
  search_query.count
end

#performObject



8
9
10
11
12
# File 'app/services/forest_liana/resources_getter.rb', line 8

def perform
  @records = @resource.unscoped.eager_load(includes)
  @records = search_query
  @records = sort_query
end

#recordsObject



14
15
16
# File 'app/services/forest_liana/resources_getter.rb', line 14

def records
  @records.offset(offset).limit(limit).to_a
end