instance method arel_attributes_values

Ruby on Rails 3.0.20

Since v3.0.20 Last seen in v3.1.12 Private

Available in: v3.0.20 v3.1.12

Signature

arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys)

Returns a copy of the attributes hash where all the values have been safely quoted for use in an Arel insert/update method.

Parameters

include_primary_key opt = true
include_readonly_attributes opt = true
attribute_names opt = @attributes.keys
Source
# File activerecord/lib/active_record/base.rb, line 1721
      def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys)
        attrs = {}
        attribute_names.each do |name|
          if (column = column_for_attribute(name)) && (include_primary_key || !column.primary)

            if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name))
              value = read_attribute(name)

              if !value.nil? && self.class.serialized_attributes.key?(name)
                value = YAML.dump value
              end
              attrs[self.class.arel_table[name]] = value
            end
          end
        end
        attrs
      end

Defined in activerecord/lib/active_record/base.rb line 1721 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close