Sha256: 305abb4ba7341948fed13b625744c034fc6b305db64efcd11a727df69b8977f4

Contents?: true

Size: 735 Bytes

Versions: 14

Compression:

Stored size: 735 Bytes

Contents

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

    def get_resource
      use_act_as_paranoid = @resource.instance_methods
        .include? :really_destroyed?

      # NOTICE: Do not unscope with the paranoia gem to prevent the retrieval
      #         of deleted records.
      use_act_as_paranoid ? @resource : @resource.unscoped
    end

    def includes_for_serialization
      includes_initial = includes
      includes_for_smart_belongs_to = @collection.fields_smart_belongs_to.map { |field| field[:field] }
      includes_initial.concat(includes_for_smart_belongs_to).map(&:to_s)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
forest_liana-2.11.5 app/services/forest_liana/base_getter.rb
forest_liana-2.11.4 app/services/forest_liana/base_getter.rb
forest_liana-2.11.3 app/services/forest_liana/base_getter.rb
forest_liana-2.11.2 app/services/forest_liana/base_getter.rb
forest_liana-2.11.1 app/services/forest_liana/base_getter.rb
forest_liana-2.11.0 app/services/forest_liana/base_getter.rb
forest_liana-2.10.5 app/services/forest_liana/base_getter.rb
forest_liana-2.10.4 app/services/forest_liana/base_getter.rb
forest_liana-2.10.3 app/services/forest_liana/base_getter.rb
forest_liana-2.10.2 app/services/forest_liana/base_getter.rb
forest_liana-2.10.1 app/services/forest_liana/base_getter.rb
forest_liana-2.10.0 app/services/forest_liana/base_getter.rb
forest_liana-2.9.2 app/services/forest_liana/base_getter.rb
forest_liana-2.9.1 app/services/forest_liana/base_getter.rb