Module: ActiveRecord::AttributeMethods
- Extended by:
- ActiveSupport::Autoload, ActiveSupport::Concern
- Includes:
- ActiveModel::AttributeMethods
- Defined in:
- lib/active_record/attribute_methods.rb,
lib/active_record.rb,
lib/active_record/attribute_methods/read.rb,
lib/active_record/attribute_methods/dirty.rb,
lib/active_record/attribute_methods/query.rb,
lib/active_record/attribute_methods/write.rb,
lib/active_record/attribute_methods/primary_key.rb,
lib/active_record/attribute_methods/before_type_cast.rb,
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
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args, &block) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/active_record/attribute_methods.rb', line 37 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?(*args) ⇒ Boolean
50 51 52 53 |
# File 'lib/active_record/attribute_methods.rb', line 50 def respond_to?(*args) self.class.define_attribute_methods unless self.class.attribute_methods_generated? super end |