spree_core 2.4.1 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c3f728999034d676a7bade2faa38354f43b90e7
4
- data.tar.gz: f4112e883677f3f9561afac00de040a5191141d5
3
+ metadata.gz: ba580156220b00d34fc3e53b377d8cc18c1b5e40
4
+ data.tar.gz: b1da5a7c06ce42c05cfd85b3f26d2b794fc8c6cd
5
5
  SHA512:
6
- metadata.gz: abc9b0511722dada69919986af38a1c160ea1b4eae247936d57bc0e9bf9316e699e2dfb15469dcfec67ccd59a54fc1689cabb7a19960f00bedf2fbab38edb231
7
- data.tar.gz: 6e515054c8250211a602f28d42dcc519502ca09f2928a755546ae44860fea1bc8499562fbf30a70300c75311095f7f69093d26805158d0d4c769eade5dd4247f
6
+ metadata.gz: 4f7cd56bd89e16dbe00265c7d2c61c26dd8740118afceff4716b08af953f8cadd2189c831c3411913802ab2799a80b3a8c29a3de2d8118b6f767fc09361515fd
7
+ data.tar.gz: a45727d4f2c709b5e072a92f6cd2098b0b95165c43b5039d3d7c2a6bed127d4a792e43a90a80ff060c45a18f332716bb2d94899c54c748a592980d62b67149c2
@@ -101,6 +101,8 @@ module Spree
101
101
  end
102
102
 
103
103
  def options=(options={})
104
+ return unless options.present?
105
+
104
106
  opts = options.dup # we will be deleting from the hash, so leave the caller's copy intact
105
107
 
106
108
  currency = opts.delete(:currency) || order.try(:currency)
@@ -4,7 +4,7 @@ module Spree
4
4
  acts_as_list scope: :option_type
5
5
  has_and_belongs_to_many :variants, join_table: 'spree_option_values_variants', class_name: "Spree::Variant"
6
6
 
7
- validates :name, presence: true, uniqueness: true
7
+ validates :name, presence: true, uniqueness: { scope: :option_type_id }
8
8
  validates :presentation, presence: true
9
9
 
10
10
  after_touch :touch_all_variants
@@ -18,7 +18,7 @@ module Spree
18
18
  def state_text
19
19
  state.try(:abbr) || state.try(:name) || state_name
20
20
  end
21
-
21
+
22
22
  # Wrapper for creating a new stock item respecting the backorderable config
23
23
  def propagate_variant(variant)
24
24
  self.stock_items.create!(variant: variant, backorderable: self.backorderable_default)
@@ -31,12 +31,31 @@ module Spree
31
31
  self.stock_item(variant) || propagate_variant(variant)
32
32
  end
33
33
 
34
- def stock_item(variant)
35
- stock_items.where(variant_id: variant).order(:id).first
34
+ # Returns an instance of StockItem for the variant id.
35
+ #
36
+ # @param variant_id [String] The id of a variant.
37
+ #
38
+ # @return [StockItem] Corresponding StockItem for the StockLocation's variant.
39
+ def stock_item(variant_id)
40
+ stock_items.where(variant_id: variant_id).order(:id).first
36
41
  end
37
42
 
38
- def stock_item_or_create(variant)
39
- stock_item(variant) || stock_items.create(variant: variant)
43
+ # Attempts to look up StockItem for the variant, and creates one if not found.
44
+ # This method accepts an id or instance of the variant since it is used in
45
+ # multiple ways. Other methods in this model attempt to pass a variant,
46
+ # but controller actions can pass just the variant id as a parameter.
47
+ #
48
+ # @param variant_or_id [Variant|String] Variant instance or string id of a variant.
49
+ #
50
+ # @return [StockItem] Corresponding StockItem for the StockLocation's variant.
51
+ def stock_item_or_create(variant_or_id)
52
+ vid = if variant_or_id.is_a?(Variant)
53
+ variant_or_id.id
54
+ else
55
+ ActiveSupport::Deprecation.warn "Passing a Variant ID is deprecated, and will be removed in Spree 3. Please pass a variant instance instead.", caller
56
+ variant_or_id
57
+ end
58
+ stock_item(vid) || stock_items.create(variant_id: vid)
40
59
  end
41
60
 
42
61
  def count_on_hand(variant)
@@ -25,7 +25,7 @@ module Spree
25
25
  default_url: '/assets/default_taxon.png'
26
26
 
27
27
  validates_attachment :icon,
28
- content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
28
+ content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] }
29
29
 
30
30
  # indicate which filters should be used for a taxon
31
31
  # this method should be customized to your own site
@@ -389,7 +389,7 @@ en:
389
389
  add_stock_management: Add Stock Management
390
390
  add_to_cart: Add To Cart
391
391
  add_variant: Add Variant
392
- additional_item: Additional Item Cost
392
+ additional_item: Additional Item
393
393
  address1: Address
394
394
  address2: Address (contd.)
395
395
  adjustable: Adjustable
@@ -715,7 +715,7 @@ en:
715
715
  finalize: Finalize
716
716
  find_a_taxon: Find a Taxon
717
717
  finalized: Finalized
718
- first_item: First Item Cost
718
+ first_item: First Item
719
719
  first_name: First Name
720
720
  first_name_begins_with: First Name Begins With
721
721
  flat_percent: Flat Percent
@@ -754,6 +754,8 @@ en:
754
754
  identifier: Identifier
755
755
  image: Image
756
756
  images: Images
757
+ implement_eligible_for_return: "Must implement #eligible_for_return? for your EligibilityValidator."
758
+ implement_requires_manual_intervention: "Must implement #requires_manual_intervention? for your EligibilityValidator."
757
759
  inactive: Inactive
758
760
  incl: incl.
759
761
  included_in_price: Included in Price
@@ -842,8 +844,6 @@ en:
842
844
  month: Month
843
845
  more: More
844
846
  move_stock_between_locations: Move Stock Between Locations
845
- must_implement_eligible_for_return: "Must implement #eligible_for_return? for your EligibilityValidator."
846
- must_implement_requires_manual_intervention: "Must implement #requires_manual_intervention? for your EligibilityValidator."
847
847
  my_account: My Account
848
848
  my_orders: My Orders
849
849
  name: Name
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "2.4.1"
3
+ "2.4.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant