123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::Attributes

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: activerecord/lib/active_record/attributes.rb

Overview

See ClassMethods for documentation

Constant Summary

::ActiveModel::AttributeMethods - Included

CALL_COMPILABLE_REGEXP, NAME_COMPILABLE_REGEXP

::ActiveModel::Attributes::Normalization - Attributes & Methods

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Attribute Summary

::ActiveModel::Dirty - self

#attribute_aliases, #attribute_aliases?, #attribute_method_patterns, #attribute_method_patterns?,
#changed?

Returns true if any of the attributes has unsaved changes, false otherwise.

Instance Method Summary

::ActiveModel::Validations::Callbacks - self

#run_validations!

Override run_validations! to include callbacks.

::ActiveModel::Dirty - self

#attribute_changed?

Dispatch target for *_changed? attribute methods.

#attribute_previously_changed?

Dispatch target for *_previously_changed? attribute methods.

#attribute_previously_was

Dispatch target for *_previously_was attribute methods.

#attribute_was

Dispatch target for *_was attribute methods.

#changed

Returns an array with the name of the attributes with unsaved changes.

#changed_attributes

Returns a hash of the attributes with unsaved changes indicating their original values like attr => original value.

#changes

Returns a hash of changed attributes indicating their original and new values like attr => [original value, new value].

#changes_applied

Clears dirty data and moves changes to previous_changes and mutations_from_database to mutations_before_last_save respectively.

#clear_attribute_changes,
#clear_changes_information

Clears all dirty data: current changes and previous changes.

#previous_changes

Returns a hash of attributes that were changed before the model was saved.

#restore_attributes

Restore all previous data of the provided attributes.

#attribute_change

Dispatch target for *_change attribute methods.

#attribute_previous_change

Dispatch target for *_previous_change attribute methods.

#attribute_will_change!

Dispatch target for *_will_change! attribute methods.

#clear_attribute_change, #forget_attribute_assignments, #init_internals, #mutations_before_last_save, #mutations_from_database,
#restore_attribute!

Dispatch target for restore_*! attribute methods.

#as_json, #attribute_changed_in_place?, #init_attributes, #initialize_dup

::ActiveModel::AttributeMethods - Included

#attribute_missing

attribute_missing is like method_missing, but for attributes.

#method_missing

Allows access to the object attributes, which are held in the hash returned by attributes, as though they were first-class methods.

#respond_to?,
#respond_to_without_attributes?

A Person instance with a name attribute can ask person.respond_to?(:name), person.respond_to?(:name=), and person.respond_to?(:name?) which will all return true.

#_read_attribute, #attribute_method?,
#matched_attribute_method

Returns a struct representing the matching attribute method.

#missing_attribute

::ActiveModel::Attributes::Normalization - Included

#normalize_attribute

Normalizes a specified attribute using its declared normalizations.

#normalize_changed_in_place_attributes

Class Attribute Details

.normalized_attributes (rw)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attributes/normalization.rb', line 12

class_attribute :normalized_attributes, default: Set.new

.normalized_attributes?Boolean (rw)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attributes/normalization.rb', line 12

class_attribute :normalized_attributes, default: Set.new

Instance Attribute Details

#normalized_attributes (rw)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attributes/normalization.rb', line 12

class_attribute :normalized_attributes, default: Set.new

#normalized_attributes?Boolean (rw)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attributes/normalization.rb', line 12

class_attribute :normalized_attributes, default: Set.new