Class: ForestLiana::BaseGetter

Inherits:
Object
  • Object
show all
Includes:
RecordFindable
Defined in:
app/services/forest_liana/base_getter.rb

Instance Method Summary collapse

Instance Method Details

#get_collection(collection_name) ⇒ Object



5
6
7
# File 'app/services/forest_liana/base_getter.rb', line 5

def get_collection(collection_name)
  ForestLiana.apimap.find { |collection| collection.name.to_s == collection_name }
end

#get_resourceObject



9
10
11
# File 'app/services/forest_liana/base_getter.rb', line 9

def get_resource
  @resource.instance_methods.include?(:really_destroyed?) ? @resource : @resource.unscoped
end

#includes_for_serializationObject



13
14
15
16
17
18
# File 'app/services/forest_liana/base_getter.rb', line 13

def includes_for_serialization
  includes_for_smart_belongs_to = @collection.fields_smart_belongs_to.map { |field| field[:field] }
  includes_for_smart_belongs_to &= @field_names_requested if @field_names_requested

  @includes.concat(includes_for_smart_belongs_to).map(&:to_s)
end