Module: Mongoid::Attributes

Included in:
Document
Defined in:
lib/mongoid/attributes.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#process(fields, params) ⇒ Object

Process the provided attributes casting them to their proper values if a field exists for them on the Document.



5
6
7
8
9
10
# File 'lib/mongoid/attributes.rb', line 5

def process(fields, params)
  attributes = HashWithIndifferentAccess.new(params)
  attributes.each_pair do |key, value|
    attributes[key] = fields[key].value(value) if fields[key]
  end
end