Sha256: 67b5e3eef787b5d9e5a3cfd0973fbaed9aee98ee02439a6a880c635c8387b423

Contents?: true

Size: 541 Bytes

Versions: 3

Compression:

Stored size: 541 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 EpomRails.config.offline 
          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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
epom_rails-1.4.4 lib/epom_rails/acts_as_placement.rb
epom_rails-1.4.2 lib/epom_rails/acts_as_placement.rb
epom_rails-1.4.1 lib/epom_rails/acts_as_placement.rb