Module | ActiveRecord::AttributeMethods::ClassMethods
In: | lib/active_record/attribute_methods.rb

Declare and check for suffixed attribute methods.

### Methods

attribute_method_suffix match_attribute_method?

### Public Instance methods

attribute_method_suffix(*suffixes)

Declare a method available for all attributes with the given suffix. Uses method_missing and respond_to? to rewrite the method

      #{attr}#{suffix}(*args, &block)

to

      attribute#{suffix}(#{attr}, *args, &block)

An attribute#{suffix} instance method must exist and accept at least the attr argument.

For example:

      class Person < ActiveRecord::Base
        attribute_method_suffix '_changed?'

        private
          def attribute_changed?(attr)
            ...
          end
      end

      person = Person.find(1)
      person.name_changed?    # => false
      person.name = 'Hubert'
      person.name_changed?    # => true

match_attribute_method?(method_name)

Returns MatchData if method_name is an attribute method.

[Validate]