Method: Reform::Form::ActiveModel::ModelValidations::Mapping.from_representable_attrs
- Defined in:
- lib/reform/form/active_model/model_validations.rb
.from_representable_attrs(attrs) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/reform/form/active_model/model_validations.rb', line 63 def self.from_representable_attrs(attrs) new.tap do |mapping| attrs.each do |dfn| from = dfn.name.to_sym to = [dfn[:on], (dfn[:private_name] || dfn.name)].compact.map(&:to_sym) mapping.add(from, to) end end end |