Class: ParamAccessible::Rules

Inherits:
Array
  • Object
show all
Defined in:
lib/param_accessible/rules.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ Rules

Returns a new instance of Rules.



5
6
7
8
# File 'lib/param_accessible/rules.rb', line 5

def initialize parent = nil
  content = (parent.to_a if parent) || []
  super content
end

Instance Method Details

#detect_inaccessible_params(controller) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/param_accessible/rules.rb', line 10

def detect_inaccessible_params controller
  accessible_params = {}
  
  each do |rule|
    rule.accessible_params_for controller, accessible_params
  end
  
  detect_inaccessible_hash controller.params, accessible_params, []
end

#push(*args) ⇒ Object



20
21
22
# File 'lib/param_accessible/rules.rb', line 20

def push *args
  super Rule.new(*args)
end