Class: CanCanCan::ActiveGraph::SingleRuleCypher
- Inherits:
-
Object
- Object
- CanCanCan::ActiveGraph::SingleRuleCypher
- Defined in:
- lib/cancancan/active_graph/single_rule_cypher.rb
Overview
Return records for single cancan rule
Instance Attribute Summary collapse
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
-
#initialize(rule, model_class) ⇒ SingleRuleCypher
constructor
A new instance of SingleRuleCypher.
- #records ⇒ Object
Constructor Details
#initialize(rule, model_class) ⇒ SingleRuleCypher
Returns a new instance of SingleRuleCypher.
8 9 10 11 |
# File 'lib/cancancan/active_graph/single_rule_cypher.rb', line 8 def initialize(rule, model_class) @rule = rule @model_class = model_class end |
Instance Attribute Details
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
7 8 9 |
# File 'lib/cancancan/active_graph/single_rule_cypher.rb', line 7 def model_class @model_class end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
7 8 9 |
# File 'lib/cancancan/active_graph/single_rule_cypher.rb', line 7 def rule @rule end |
Instance Method Details
#records ⇒ Object
13 14 15 16 17 18 |
# File 'lib/cancancan/active_graph/single_rule_cypher.rb', line 13 def records conds = rule.conditions return conds if conds.is_a?(::ActiveGraph::Node::Query::QueryProxy) || conds.is_a?(::ActiveGraph::Node::HasN::AssociationProxy) return records_for_no_conditions if conds.blank? records_for_hash_conditions end |