solidus_multi_domain 1.1.3 → 1.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b8bdc0340da89be57fbe0bc2b9bb9bf6044576e
|
4
|
+
data.tar.gz: 5973b260b06c23a72a87aa8e8337ae441dec038f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d66c31d78d2f144edd1b3b145ca0226968f9e52eb7e15fc332c8583287ae906f6c047c924e42b0f5ed6e84b78a46da7210df147667771d3027ad7b3d55091869
|
7
|
+
data.tar.gz: d3f62ce75db1290aa3eb6369d18dbcfec2c77b1f213777ad846b693b9032a27af584ed36cfc008e6bc386aaa82a52ca59c89bd15bc6af8d5aa483c03febb3bbb
|
@@ -1,7 +1,19 @@
|
|
1
1
|
Spree::Tracker.class_eval do
|
2
2
|
belongs_to :store
|
3
3
|
|
4
|
-
def self.current(
|
5
|
-
|
4
|
+
def self.current(store)
|
5
|
+
if store.is_a?(Spree::Store)
|
6
|
+
Spree::Tracker.where(active: true, store_id: store).first
|
7
|
+
else
|
8
|
+
# TODO: Remove in 2.0
|
9
|
+
ActiveSupport::Deprecation.warn <<-EOS.squish, caller
|
10
|
+
Calling Spree::Tracker.current with a string is DEPRECATED. Instead
|
11
|
+
pass it an instance of Spree::Store.
|
12
|
+
EOS
|
13
|
+
Spree::Tracker.where(active: true).joins(:store).where(
|
14
|
+
"spree_stores.code = ? OR spree_stores.url LIKE ?",
|
15
|
+
store, "%#{store}%"
|
16
|
+
).first
|
17
|
+
end
|
6
18
|
end
|
7
19
|
end
|
@@ -15,7 +15,7 @@ module SpreeMultiDomain
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def current_tracker
|
18
|
-
@current_tracker ||= Spree::Tracker.current(
|
18
|
+
@current_tracker ||= Spree::Tracker.current(current_store)
|
19
19
|
end
|
20
20
|
|
21
21
|
def get_taxonomies
|
@@ -27,10 +27,5 @@ module SpreeMultiDomain
|
|
27
27
|
def add_current_store_id_to_params
|
28
28
|
params[:current_store_id] = current_store.try(:id)
|
29
29
|
end
|
30
|
-
|
31
|
-
private
|
32
|
-
def store_key
|
33
|
-
request.headers['HTTP_SPREE_STORE'] || request.env['SERVER_NAME']
|
34
|
-
end
|
35
30
|
end
|
36
31
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.name = "solidus_multi_domain"
|
6
|
-
s.version = "1.
|
6
|
+
s.version = "1.2.0"
|
7
7
|
s.summary = "Adds multiple site support to Solidus"
|
8
8
|
s.description = "Multiple Solidus stores on different domains - single unified backed for processing orders."
|
9
9
|
s.required_ruby_version = ">= 2.1"
|
@@ -9,11 +9,21 @@ describe Spree::Tracker do
|
|
9
9
|
@tracker2 = FactoryGirl.create(:tracker, store: @another_store)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
13
|
-
expect(Spree::Tracker.current(
|
12
|
+
it "finds tracker by store" do
|
13
|
+
expect(Spree::Tracker.current(@store)).to eq @tracker
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
17
|
-
|
16
|
+
it "finds tracker based on store code" do
|
17
|
+
aggregate_failures do
|
18
|
+
expect(ActiveSupport::Deprecation).to receive(:warn)
|
19
|
+
expect(Spree::Tracker.current('STORE2')).to eq @tracker2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "finds tracker based on store url" do
|
24
|
+
aggregate_failures do
|
25
|
+
expect(ActiveSupport::Deprecation).to receive(:warn)
|
26
|
+
expect(Spree::Tracker.current(@store.url)).to eq @tracker
|
27
|
+
end
|
18
28
|
end
|
19
29
|
end
|