Sha256: 41d78b530fe100354dd30d9306032406e0bab4cb7ee053c04292a382205960e9

Contents?: true

Size: 448 Bytes

Versions: 56

Compression:

Stored size: 448 Bytes

Contents

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

    def perform
      @record = @resource.find(@params[:id])
      new_value = @association.klass.find(@data[:id]) if @data && @data[:id]
      @record.send("#{@association.name}=", new_value)

      @record.save()
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
forest_liana-1.6.11 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.10 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.7 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.6 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.5 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.4 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.3 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.2 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.1 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.6.0 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.26 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.25 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.24 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.23 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.22 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.21 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.20 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.19 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.18 app/services/forest_liana/belongs_to_updater.rb
forest_liana-1.5.17 app/services/forest_liana/belongs_to_updater.rb