scope_chain 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/scope_chain/version.rb +1 -1
- data/lib/scope_chain.rb +7 -2
- metadata +1 -1
data/lib/scope_chain/version.rb
CHANGED
data/lib/scope_chain.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require "scope_chain/version"
|
2
2
|
|
3
3
|
module ScopeChain
|
4
|
+
module RspecHelpers
|
5
|
+
def scope_chain(&block)
|
6
|
+
ScopeChain.for(described_class, &block)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
4
10
|
def self.for(klass, &block)
|
5
11
|
Chain.new klass, &block
|
6
12
|
end
|
@@ -112,7 +118,7 @@ module ScopeChain
|
|
112
118
|
end
|
113
119
|
|
114
120
|
def link_named_scopes
|
115
|
-
return unless klass.respond_to?(:scopes)
|
121
|
+
return unless klass.respond_to?(:scopes) && klass.scopes.present?
|
116
122
|
|
117
123
|
klass.scopes[klass.name].each do |named|
|
118
124
|
self.define_singleton_method(named) do |*arguments|
|
@@ -135,5 +141,4 @@ class ActiveRecord::Base
|
|
135
141
|
class << self
|
136
142
|
alias_method_chain :scope, :tracking
|
137
143
|
end
|
138
|
-
|
139
144
|
end
|