Sha256: 6a4b28639c89a280681995f7dd1cc17fd66f2422d9a3c201581a7fba712d056e

Contents?: true

Size: 538 Bytes

Versions: 379

Compression:

Stored size: 538 Bytes

Contents

module ForestLiana
  class HasManyAssociator
    def initialize(resource, association, params)
      @resource = resource
      @association = association
      @params = params
      @data = params['data']
    end

    def perform
      @record = @resource.find(@params[:id])
      associated_records = @resource.find(@params[:id]).send(@association.name)

      if @data.is_a?(Array)
        @data.each do |record_added|
          associated_records << @association.klass.find(record_added[:id])
        end
      end
    end
  end
end

Version data entries

379 entries across 379 versions & 1 rubygems

Version Path
forest_liana-9.11.1 app/services/forest_liana/has_many_associator.rb
forest_liana-9.11.0 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.6 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.5 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.4 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.3 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.2 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.1 app/services/forest_liana/has_many_associator.rb
forest_liana-9.10.0 app/services/forest_liana/has_many_associator.rb
forest_liana-9.9.1 app/services/forest_liana/has_many_associator.rb
forest_liana-9.9.0 app/services/forest_liana/has_many_associator.rb
forest_liana-9.8.0 app/services/forest_liana/has_many_associator.rb
forest_liana-9.7.0 app/services/forest_liana/has_many_associator.rb
forest_liana-9.6.4 app/services/forest_liana/has_many_associator.rb
forest_liana-9.6.3 app/services/forest_liana/has_many_associator.rb
forest_liana-9.6.0 app/services/forest_liana/has_many_associator.rb
forest_liana-9.5.7 app/services/forest_liana/has_many_associator.rb
forest_liana-9.5.6 app/services/forest_liana/has_many_associator.rb
forest_liana-9.5.5 app/services/forest_liana/has_many_associator.rb
forest_liana-9.5.4 app/services/forest_liana/has_many_associator.rb