app/controllers/spree/api/retailops/catalog_controller.rb
# Try to generically apply stuff that isn't standard Spree features
Try to generically apply stuff that isn't standard Spree features
Try to generically apply stuff that isn ' t standard Spree features
def apply_extensions target, hash
            return unless hash
            hash.kind_of? Hash or raise "extension object must be a hash if provided"
            hash.each do |name, value|
              name = name.to_s; value = value.to_s
              if target.respond_to? "retailops_extend_#{name}="
                target.public_send("retailops_extend_#{name}=", value)
              elsif target.kind_of?(ActiveRecord::Base) && target.class.column_names.include?(name)
                target.attributes = { name => value }
              elsif value.blank?
              else
                add_warn("Extension field #{name} (#{target.class}) not available on this instance")
              end
            end
          end
def apply_extensions target , hash return unless hash hash . kind_of? Hash or raise "extension object must be a hash if provided" hash . each do | name , value | name = name . to_s ; value = value . to_s if target . respond_to? "retailops_extend_#{name}=" target . public_send ( "retailops_extend_#{name}=" , value ) elsif target . kind_of? ( ActiveRecord :: Base ) && target . class . column_names . include? ( name ) target . attributes = { name => value } elsif value . blank? else add_warn ( "Extension field #{name} (#{target.class}) not available on this instance" ) end end end
Try to generically apply stuff that isn't standard Spree features
Try to generically apply stuff that isn ' t standard Spree features
#allow specific behavior for custom development, if needed # this is a little dangerous but it should catch 90% of custom development with no added work # ignore attempts to delete an extension that never existed # else carp
target
<not_specific>
hash
<not_specific>