mongoid_ability 0.1.4 → 0.1.5
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 +6 -0
- 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: b0209253f4d3a2037374e99a68afa6770b29990d
|
4
|
+
data.tar.gz: 0de330daa38560a90247123dfd1aecb9674ab514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc4cb9300ee1bfcc39d1969c3add556be0399f0fd12501cded61b9f402535229a4e0691caff7706ec9c3008cd50a05cf6514642426973050dc5641d5420344d
|
7
|
+
data.tar.gz: 0fc9087fcc51d86c025b0daec0e615a0183f97cebb9fe6cb6d6369427ce49214f0cfda81c5f90801a3cd5dafa2f9901e32a1fc49657e414f23ce71a87b81b8a6
|
@@ -74,5 +74,11 @@ module MongoidAbility
|
|
74
74
|
lambda { |doc| can? action, doc }
|
75
75
|
end
|
76
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 }
|
81
|
+
end
|
82
|
+
|
77
83
|
end
|
78
84
|
end
|