Sha256: 0f0c1395affa8daaff8d2ad50dda2bd00479c820c621397662f9665428d8b40e

Contents?: true

Size: 568 Bytes

Versions: 56

Compression:

Stored size: 568 Bytes

Contents

module ForestLiana
  class ResourceGetter < BaseGetter
    attr_accessor :record

    def initialize(resource, params)
      @resource = resource
      @params = params
      @collection_name = ForestLiana.name_for(@resource)
      @collection = get_collection(@collection_name)
    end

    def perform
      @record = get_resource().eager_load(includes).find(@params[:id])
    end

    def includes
      SchemaUtils.one_associations(@resource)
        .select { |association| SchemaUtils.model_included?(association.klass) }
        .map(&:name)
    end

  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
forest_liana-2.10.3 app/services/forest_liana/resource_getter.rb
forest_liana-2.10.2 app/services/forest_liana/resource_getter.rb
forest_liana-2.10.1 app/services/forest_liana/resource_getter.rb
forest_liana-2.10.0 app/services/forest_liana/resource_getter.rb
forest_liana-2.9.2 app/services/forest_liana/resource_getter.rb
forest_liana-2.9.1 app/services/forest_liana/resource_getter.rb
forest_liana-2.9.0 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.6 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.5 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.4 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.3 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.2 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.1 app/services/forest_liana/resource_getter.rb
forest_liana-2.8.0 app/services/forest_liana/resource_getter.rb
forest_liana-2.7.0 app/services/forest_liana/resource_getter.rb
forest_liana-2.6.1 app/services/forest_liana/resource_getter.rb