spree_core 0.50.3 → 0.50.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -90,10 +90,14 @@ class ProductGroup < ActiveRecord::Base
90
90
  end
91
91
 
92
92
  def add_scope(scope_name, arguments=[])
93
- self.product_scopes << ProductScope.new({
94
- :name => scope_name.to_s,
95
- :arguments => [*arguments]
96
- })
93
+ if scope_name.to_s !~ /eval|send|system|[^a-z0-9_!?]/
94
+ self.product_scopes << ProductScope.new({
95
+ :name => scope_name.to_s,
96
+ :arguments => [*arguments]
97
+ })
98
+ else
99
+ raise ArgumentError.new("'#{scope_name}` can't be used as scope")
100
+ end
97
101
  self
98
102
  end
99
103
 
@@ -31,7 +31,7 @@ class ProductScope < ActiveRecord::Base
31
31
  Product.send(self.name.intern, *array)
32
32
  end
33
33
  else
34
- relation2 = Product.search({self.name.intern => array}).relation
34
+ relation2 = Product.metasearch({self.name.intern => array}).relation
35
35
  end
36
36
  unless another_scope.class == ActiveRecord::Relation
37
37
  another_scope = another_scope.send(:relation)
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "0.50.3"
3
+ "0.50.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 209
4
+ hash: 223
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 50
9
- - 3
10
- version: 0.50.3
9
+ - 4
10
+ version: 0.50.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Schofield