lib/.rbnext/3.0/action_policy/policy/aliases.rb in action_policy-0.5.6 vs lib/.rbnext/3.0/action_policy/policy/aliases.rb in action_policy-0.5.7
- old
+ new
@@ -29,11 +29,19 @@
end
def resolve_rule(activity)
self.class.lookup_alias(activity) ||
(activity if respond_to?(activity)) ||
+ (check_rule_naming(activity) if ActionPolicy.enforce_predicate_rules_naming) ||
self.class.lookup_default_rule ||
super
+ end
+
+ private def check_rule_naming(activity)
+ unless activity[-1] == "?"
+ raise NonPredicateRule.new(self, activity)
+ end
+ nil
end
module ClassMethods # :nodoc:
def default_rule(val)
rules_aliases[DEFAULT] = val