Sha256: cf0af9ad6b7e60b99ace4917ba2680f511657d44c1391e37c8df02de63cfa566

Contents?: true

Size: 542 Bytes

Versions: 21

Compression:

Stored size: 542 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_deleted|
          associated_records << @association.klass.find(record_deleted[:id])
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
forest_liana-1.4.7 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.6 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.5 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.4 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.3 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.2 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.1 app/services/forest_liana/has_many_associator.rb
forest_liana-1.4.0 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.53 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.52 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.51 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.50 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.49 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.48 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.47 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.46 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.45 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.44 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.43 app/services/forest_liana/has_many_associator.rb
forest_liana-1.3.42 app/services/forest_liana/has_many_associator.rb