Sha256: 76b4f790a2e49746017ba95b2d7f498b5a2e21d7a6e43031da0bb9042e10fb85

Contents?: true

Size: 470 Bytes

Versions: 1

Compression:

Stored size: 470 Bytes

Contents

class ActiveRecord::Base 

  def self.acts_as_placement(params = {})
  	EpomRails.config.placement[:model] = self
    acts_as(Epom::Placement, params)

    define_key_method
  end

  private
	def self.define_key_method
    self.class_eval do
      def epom_key
        unless @epom_key
          response = Epom::Placement.get_placement_summary({placementIds: self.epom_id})
          @epom_key = response[0]['key']
        end
		  	@epom_key
      end
    end
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epom_rails-1.4.0 lib/epom_rails/acts_as_placement.rb