instance method define_attribute_methods

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v3.2.22.5

Available in: v2.2.3 v2.3.18 v3.0.20 v3.1.12 v3.2.22.5

Signature

define_attribute_methods()

Generates all the attribute related methods for columns in the database accessors, mutators and query methods.

Source
# File activerecord/lib/active_record/attribute_methods.rb, line 69
      def define_attribute_methods
        return if generated_methods?
        columns_hash.each do |name, column|
          unless instance_method_already_implemented?(name)
            if self.serialized_attributes[name]
              define_read_method_for_serialized_attribute(name)
            elsif create_time_zone_conversion_attribute?(name, column)
              define_read_method_for_time_zone_conversion(name)
            else
              define_read_method(name.to_sym, name, column)
            end
          end

          unless instance_method_already_implemented?("#{name}=")
            if self.serialized_attributes[name]
              define_write_method_for_serialized_attribute(name)
            elsif create_time_zone_conversion_attribute?(name, column)
              define_write_method_for_time_zone_conversion(name)
            else  
              define_write_method(name.to_sym)
            end
          end

          unless instance_method_already_implemented?("#{name}?")
            define_question_method(name)
          end
        end
      end

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

Defined in ActiveRecord::AttributeMethods::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close