piggybak_variants 0.1.0 → 0.1.1

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: 21f091a2e1ce6be384810b86e9d320f0d6789aca
4
- data.tar.gz: cf94b7a11ed463e3d5199319ce3c91e9bb85eb38
3
+ metadata.gz: 974b650d16ee057bba72c9366c5d4b7942f1efc1
4
+ data.tar.gz: bf3f13b6c8fadce6fe36c9848feccfd01ba2f6ac
5
5
  SHA512:
6
- metadata.gz: ef38a0103338568ca28187fd5d585f7059b86cb82a7e2e372caec305c92d313abd2bc7344222b626e1a0b525fae567f9ae098b88d03e0e77c24231bec5fb2626
7
- data.tar.gz: 029fdff18768f7254eff52decfc0546f44206bdb1cd3b0345d82d83b2f3b64e385cf88599a2c58f3d8c488edb125b6ec820865750e068ba06fee412b558e086a
6
+ metadata.gz: 9e6191beaa9c9b397c01bc4ac02c34e6af43f985404e4f74d5f09b219acc7b366a47419e0c136a4026f4717a58ba08a1b1cbf1839549f8ecc47619441d368dbd
7
+ data.tar.gz: a7ce4b1db46fbc2fa48542266bede6e8a7f818c3602e69772668829ff5e64eb3d4e10df2c3d107005665914d6a1da5af3f03387b2be1ec0f826afd85b89dd00a
@@ -4,7 +4,7 @@ module PiggybakVariantsHelper
4
4
  end
5
5
 
6
6
  def options_for_klass(klass)
7
- options = ::PiggybakVariants::OptionConfiguration.find_all_by_klass(klass).collect { |oc| oc.option }
7
+ options = ::PiggybakVariants::OptionConfiguration.where(klass: klass).collect { |oc| oc.option }
8
8
  end
9
9
 
10
10
  def variant_map(object)
@@ -1,9 +1,9 @@
1
1
  module PiggybakVariants
2
2
  class Option < ActiveRecord::Base
3
- has_many :option_values, :dependent => :destroy, order: 'position ASC'
3
+ has_many :option_values, -> { order(:position) }, :dependent => :destroy
4
4
  has_many :option_configurations, :dependent => :destroy
5
5
 
6
- default_scope :order => "position ASC"
6
+ default_scope { order('position ASC') }
7
7
 
8
8
  accepts_nested_attributes_for :option_values, :allow_destroy => true
9
9
 
@@ -2,9 +2,9 @@ module PiggybakVariants
2
2
  class Variant < ActiveRecord::Base
3
3
  acts_as_sellable
4
4
  belongs_to :item, :polymorphic => true
5
- has_and_belongs_to_many :option_values
5
+ has_and_belongs_to_many :option_values, :class_name => "::PiggybakVariants::OptionValue"
6
6
 
7
- scope :available, joins(:piggybak_sellable).where(["piggybak_sellables.active = ? AND (piggybak_sellables.quantity > 0 OR piggybak_sellables.unlimited_inventory = ?)",true,true])
7
+ scope :available, -> { joins(:piggybak_sellable).where(["piggybak_sellables.active = ? AND (piggybak_sellables.quantity > 0 OR piggybak_sellables.unlimited_inventory = ?)",true,true]) }
8
8
  validate :option_value_validation
9
9
  validate :require_item
10
10
 
@@ -20,7 +20,7 @@ module PiggybakVariants
20
20
  # TODO: Add verification to prevent duplicate option value sets
21
21
 
22
22
  klass = self.item.class
23
- options = ::PiggybakVariants::OptionConfiguration.find_all_by_klass(klass).collect { |oc| oc.option }
23
+ options = ::PiggybakVariants::OptionConfiguration.where(klass: klass).collect { |oc| oc.option }
24
24
  error = false
25
25
  options.each do |option|
26
26
  matching_option_values = self.option_values.select { |ov| ov.option == option }.size
@@ -1,3 +1,3 @@
1
1
  module PiggybakVariants
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggybak_variants
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Case, Steph Skardal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-27 00:00:00.000000000 Z
11
+ date: 2014-04-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Advanced variant support for Piggybak.
14
14
  email: