new(options = {}) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/attribute_methods.rb, line 393
          def initialize(options = {})
            if options[:prefix] == '' || options[:suffix] == ''
              message = "Specifying an empty prefix/suffix for an attribute method is no longer "                          "necessary. If the un-prefixed/suffixed version of the method has not been "                          "defined when `define_attribute_methods` is called, it will be defined "                          "automatically."
              ActiveSupport::Deprecation.warn message

            @prefix, @suffix = options.fetch(:prefix, ''), options.fetch(:suffix, '')
            @regex = /^(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})$/
            @method_missing_target = "#{@prefix}attribute#{@suffix}"
            @method_name = "#{prefix}%s#{suffix}"
Register or log in to add new notes.