mongoid_ability 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid_ability/ability.rb +3 -9
- data/lib/mongoid_ability/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f9c60dd321058f51a039fcefa9c3540a91a8479
|
4
|
+
data.tar.gz: 76fa93ef759bfd5921d838ef921231ebec673788
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 764e3d241e12c19c20ac484a5e33ccb03559010337da5f09eb3d1d8a8f3641a40e9d245ad36680975fafd712ef49b563a9185e65d2342c09fc4e788273dde7dc
|
7
|
+
data.tar.gz: 6e3869323449bd68052dff3854a45bd92b618f9153d4894e50d7c4fac965ad836d68ec0eab7828db897611154f0e7fcef7d186cf256272dd11d1eea1a0d3f98b
|
@@ -69,15 +69,9 @@ module MongoidAbility
|
|
69
69
|
# .select(¤t_ability.can_destroy)
|
70
70
|
# etc.
|
71
71
|
def method_missing name, *args
|
72
|
-
return super unless name.to_s =~ /\
|
73
|
-
return unless action = name.to_s.gsub(/\
|
74
|
-
lambda { |doc| can? action, doc }
|
75
|
-
end
|
76
|
-
|
77
|
-
def method_missing name, *args
|
78
|
-
return super unless name.to_s =~ /\Acannot_/
|
79
|
-
return unless action = name.to_s.gsub(/\Acannot_/, '').to_sym
|
80
|
-
lambda { |doc| cannot? action, doc }
|
72
|
+
return super unless name.to_s =~ /\A(can|cannot)_/
|
73
|
+
return unless action = name.to_s.gsub(/\A(can|cannot)_/, '').to_sym
|
74
|
+
name =~ /can_/ ? lambda { |doc| can? action, doc } : lambda { |doc| cannot? action, doc }
|
81
75
|
end
|
82
76
|
|
83
77
|
end
|