Sha256: ee78727c244010b4d3e969a273529b3064d822c410f7f389468fe96d3a58fd90
Contents?: true
Size: 556 Bytes
Versions: 1
Compression:
Stored size: 556 Bytes
Contents
module InsalesApi class ProductFieldValue < Base self.prefix = "#{prefix}products/:product_id/" class << self def find_by_field_id(params) field_id = params[:product_field_id] all(params: { product_id: params[:product_id] }) .find { |x| x.product_field_id == field_id } end def create_or_update(params) if (value = find_by_field_id(params)) value.update_attribute(:value, params[:value]) value else create(params) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
insales_api-0.2.0 | lib/insales_api/product_field_value.rb |