Sha256: 66b62f6f40013069f6a066fc870a7d05a6e91dd9d0157a519a568f00e5f268c0
Contents?: true
Size: 552 Bytes
Versions: 4
Compression:
Stored size: 552 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
4 entries across 4 versions & 1 rubygems