Module: ActiveRecord::AttributeMethods
- Extended by:
- ActiveSupport::Autoload, ActiveSupport::Concern
- Includes:
- ActiveModel::AttributeMethods
- Defined in:
- activerecord/lib/active_record/attribute_methods.rb,
activerecord/lib/active_record.rb,
activerecord/lib/active_record/attribute_methods/read.rb,
activerecord/lib/active_record/attribute_methods/query.rb,
activerecord/lib/active_record/attribute_methods/dirty.rb,
activerecord/lib/active_record/attribute_methods/write.rb,
activerecord/lib/active_record/attribute_methods/primary_key.rb,
activerecord/lib/active_record/attribute_methods/before_type_cast.rb,
activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
Overview
Active Record Attribute Methods
Defined Under Namespace
Modules: BeforeTypeCast, ClassMethods, Dirty, PrimaryKey, Query, Read, TimeZoneConversion, Write
Constant Summary
Constants included from ActiveModel::AttributeMethods
ActiveModel::AttributeMethods::COMPILABLE_REGEXP
Instance Method Summary collapse
- #method_missing(method_id, *args, &block) ⇒ Object
- #respond_to?(name, include_private = false) ⇒ Boolean
Methods included from ActiveSupport::Concern
append_features, extended, included
Methods included from ActiveSupport::Autoload
autoload, autoload_at, autoload_under, autoloads, eager_autoload, eager_autoload!
Methods included from ActiveModel::AttributeMethods
#respond_to_without_attributes?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args, &block) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'activerecord/lib/active_record/attribute_methods.rb', line 51 def method_missing(method_id, *args, &block) # If we haven't generated any methods yet, generate them, then # see if we've created the method we're looking for. if !self.class.attribute_methods_generated? self.class.define_attribute_methods method_name = method_id.to_s guard_private_attribute_method!(method_name, args) send(method_id, *args, &block) else super end end |
Instance Method Details
#respond_to?(name, include_private = false) ⇒ Boolean
64 65 66 67 |
# File 'activerecord/lib/active_record/attribute_methods.rb', line 64 def respond_to?(name, include_private = false) self.class.define_attribute_methods unless self.class.attribute_methods_generated? super end |