Class: Controlist::Permissions::AdvancedConstrain
- Defined in:
- lib/controlist/permissions/advanced_constrain.rb
Instance Attribute Summary
Attributes inherited from Constrain
#clause, #operator, #proc_persistence, #proc_read, #property, #relation, #table_name, #value
Instance Method Summary collapse
-
#initialize(hash) ⇒ AdvancedConstrain
constructor
A new instance of AdvancedConstrain.
Constructor Details
#initialize(hash) ⇒ AdvancedConstrain
Returns a new instance of AdvancedConstrain.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/controlist/permissions/advanced_constrain.rb', line 6 def initialize(hash) self.property = hash[:property].to_s self.value = hash[:value] self.relation = hash[:relation] self.table_name = hash[:table_name] self.operator = hash[:operator] self.clause = hash[:clause] if Controlist.is_activerecord3? && (hash.has_key?(:proc_read) || hash.has_key?(:proc_persistence)) raise NotImplementedError, "Skip proc_read and proc_persistence, that features only be supported in ActiveRecord 4 or later" else self.proc_read = hash[:proc_read] self.proc_persistence = hash[:proc_persistence] end end |