spree_malls 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.ja.md +1 -1
- data/README.md +1 -1
- data/app/models/spree/variant_decorator.rb +0 -17
- metadata +1 -1
data/README.ja.md
CHANGED
@@ -15,7 +15,7 @@ Purpose
|
|
15
15
|
![Malls](https://raw.githubusercontent.com/wiki/digitalm/spree_malls/images/malls4.jpg)
|
16
16
|
|
17
17
|
モールの登録
|
18
|
-
![Malls](https://raw.githubusercontent.com/wiki/digitalm/spree_malls/images/
|
18
|
+
![Malls](https://raw.githubusercontent.com/wiki/digitalm/spree_malls/images/malls1.jpg)
|
19
19
|
|
20
20
|
依存関係
|
21
21
|
------------
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ Admin can manage Mall Price informations.
|
|
15
15
|
![Malls](https://raw.githubusercontent.com/wiki/digitalm/spree_malls/images/malls4.jpg)
|
16
16
|
|
17
17
|
Be sure to create Mall list before manage.
|
18
|
-
![Malls](https://raw.githubusercontent.com/wiki/digitalm/spree_malls/images/
|
18
|
+
![Malls](https://raw.githubusercontent.com/wiki/digitalm/spree_malls/images/malls1.jpg)
|
19
19
|
|
20
20
|
Dependency
|
21
21
|
------------
|
@@ -2,25 +2,8 @@ module Spree
|
|
2
2
|
Variant.class_eval do
|
3
3
|
has_many :add_on_mall_prices, class_name: 'Spree::AddOnMallPrice'
|
4
4
|
|
5
|
-
# builds add_on_maker_variants from created variant ids
|
6
|
-
after_create :create_add_on_mall_prices_from_variants
|
7
|
-
|
8
5
|
# enable variants to CRUD each own add_on_maker_variants by accept nesting as child
|
9
6
|
accepts_nested_attributes_for :add_on_mall_prices, allow_destroy: true
|
10
7
|
|
11
|
-
def create_add_on_mall_prices_from_variants
|
12
|
-
if Spree::AddOnMall.exists?
|
13
|
-
Spree::AddOnMallPrice.where(variant_id: self.id).first_or_initialize do |a|
|
14
|
-
a.variant_id = self.id
|
15
|
-
logger.info a.inspect
|
16
|
-
if a.save
|
17
|
-
logger.info "save completed"
|
18
|
-
else
|
19
|
-
logger.info "save imcompleted!"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
8
|
end
|
26
9
|
end
|