Flowdock
method

type_cast_attribute

Importance_0
v3.2.8 - Show latest stable - 0 notes - Class: ActiveRecord::AttributeMethods::Read::ClassMethods
type_cast_attribute(attr_name, attributes, cache = {}) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/attribute_methods/read.rb, line 40
        def type_cast_attribute(attr_name, attributes, cache = {}) #:nodoc:
          return unless attr_name
          attr_name = attr_name.to_s

          if generated_external_attribute_methods.method_defined?(attr_name)
            if attributes.has_key?(attr_name) || attr_name == 'id'
              generated_external_attribute_methods.send(attr_name, attributes[attr_name], attributes, cache, attr_name)
            end
          elsif !attribute_methods_generated?
            # If we haven't generated the caster methods yet, do that and
            # then try again
            define_attribute_methods
            type_cast_attribute(attr_name, attributes, cache)
          else
            # If we get here, the attribute has no associated DB column, so
            # just return it verbatim.
            attributes[attr_name]
          end
        end
Register or log in to add new notes.