controlist 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/lib/controlist/interceptor.rb +5 -3
- data/lib/controlist/version.rb +1 -1
- data/lib/controlist.rb +2 -1
- data/test/feature_test.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f952bb9c279383c0c30a716bb5a4a9167d58ced5
|
4
|
+
data.tar.gz: 651d13a9012be605fb85c8a05c6f1098b2976f12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2543d58024a8a29a0da1307d78b130335cbf8db9a286f32d8f32b7f06e7fe7c9bc2554d519ddd129ae1b357ce31e0c0e678bfe15400348db8ec84fc761c7ffd
|
7
|
+
data.tar.gz: f4f8b61d1f6b2497c45408588172af1448494f14075c5c77272c0c5df7ff3d4a86c2cdbebc52e85583c2fba51f1e58183139af0fbb738bf6a6ab64b7c40076f1
|
@@ -82,9 +82,10 @@ module Controlist
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
# Avoid effect fetching arel in original update method
|
86
|
+
Controlist.skip { #{method}_without_controlist(*args) }
|
87
|
+
end
|
88
|
+
alias_method_chain :#{method}, :controlist unless method_defined? :#{method}_without_controlist
|
88
89
|
}
|
89
90
|
end
|
90
91
|
end
|
@@ -97,6 +98,7 @@ module Controlist
|
|
97
98
|
self.select_values += Array.wrap(value)
|
98
99
|
end
|
99
100
|
end
|
101
|
+
#Avoid id based cache
|
100
102
|
ActiveRecord::IdentityMap.module_eval do
|
101
103
|
def self.enabled?
|
102
104
|
false
|
data/lib/controlist/version.rb
CHANGED
data/lib/controlist.rb
CHANGED
@@ -43,9 +43,10 @@ module Controlist
|
|
43
43
|
# assert_equal "SELECT \"users\".* FROM \"users\"", sql.strip
|
44
44
|
# end
|
45
45
|
def skip
|
46
|
+
is_skip = @permission_manager.skip?
|
46
47
|
@permission_manager.enable_skip
|
47
48
|
result = yield
|
48
|
-
@permission_manager.disable_skip
|
49
|
+
@permission_manager.disable_skip unless is_skip
|
49
50
|
result
|
50
51
|
end
|
51
52
|
|
data/test/feature_test.rb
CHANGED
@@ -10,6 +10,7 @@ class FeatureTest < ActiveSupport::TestCase
|
|
10
10
|
load "test/migrate.rb"
|
11
11
|
Clazz.create id: 1, name: "Grade 1"
|
12
12
|
Clazz.create id: 2, name: "Grade 2"
|
13
|
+
Clazz.create id: 3, name: "Grade 3"
|
13
14
|
User.create id: 1, name: "Tom", clazz_id: 1, age: 1
|
14
15
|
User.create id: 2, name: "Jerry", clazz_id: 1, age: 1
|
15
16
|
User.create id: 3, name: "Henry", clazz_id: 2, age: 1
|
@@ -36,6 +37,7 @@ class FeatureTest < ActiveSupport::TestCase
|
|
36
37
|
sql = relation.to_sql.gsub(/ +/, " ")
|
37
38
|
puts sql
|
38
39
|
assert_equal true, sql.include?("((users.name = 'Tom') and (clazzs.name in ('Grade 1','Grade 2')) and (users.age >= 5) and (users.age is null) and (users.age in (1,2,3)) and (users.clazz_id in (1,2,3)) and (age != 100)) ORDER BY id DESC LIMIT 3")
|
40
|
+
|
39
41
|
end
|
40
42
|
|
41
43
|
def test_permission_empty
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: controlist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|