Sha256: 475840b01225f75e7da2c35195e37d6d1ce1da1c8cbf5f89538fac74a2d28bcf

Contents?: true

Size: 773 Bytes

Versions: 6

Compression:

Stored size: 773 Bytes

Contents

json.cache! [I18n.locale, variant] do
  json.(variant, *variant_attributes)
  json.display_price(variant.display_price.to_s)
  json.options_text(variant.options_text)
  json.track_inventory(variant.should_track_inventory?)
  json.in_stock(variant.in_stock?)
  json.is_backorderable(variant.is_backorderable?)

  # We can't represent Float::INFINITY in JSON
  # Under JSON this woulb be NULL
  # Under oj this would error
  json.total_on_hand(variant.should_track_inventory? ? variant.total_on_hand : nil)

  json.is_destroyed(variant.destroyed?)
  json.option_values(variant.option_values) do |option_value|
    json.(option_value, *option_value_attributes)
  end
  json.images(variant.images) do |image|
    json.partial!("spree/api/images/image", image: image)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_api-2.5.2 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.5.1 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.5.0 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.5.0.rc1 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.5.0.beta2 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.5.0.beta1 app/views/spree/api/variants/_small.json.jbuilder