Module: StrongForm::Finder
- Defined in:
- lib/strong_form/finder.rb
Class Method Summary collapse
Class Method Details
.find_child_permitted_attributes(name, permitted_attributes) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/strong_form/finder.rb', line 3 def self.find_child_permitted_attributes(name, permitted_attributes) # find the hash with the key `child_models_attributes` attributes = permitted_attributes.find do |o| o.is_a?(Hash) && o.keys.include?(name) end return [] unless attributes attributes = attributes[name] attributes = [attributes] unless attributes.is_a?(Array) attributes end |