Sha256: 89310a9cf156145be919d13bea9d0372a3b766d49257d54b697b9544dc37f1e3

Contents?: true

Size: 740 Bytes

Versions: 138

Compression:

Stored size: 740 Bytes

Contents

require 'active_support/concern'
require 'active_support/deprecation'

module ActiveRecord
  module AttributeMethods
    module DeprecatedUnderscoreRead
      extend ActiveSupport::Concern

      included do
        attribute_method_prefix "_"
      end

      module ClassMethods
        protected

        def define_method__attribute(attr_name)
          # Do nothing, let it hit method missing instead.
        end
      end

      protected

      def _attribute(attr_name)
        ActiveSupport::Deprecation.warn(
          "You have called '_#{attr_name}'. This is deprecated. Please use " \
          "either '#{attr_name}' or read_attribute('#{attr_name}')."
        )
        read_attribute(attr_name)
      end
    end
  end
end

Version data entries

138 entries across 107 versions & 14 rubygems

Version Path
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/attribute_methods/deprecated_underscore_read.rb
activerecord-3.2.13 lib/active_record/attribute_methods/deprecated_underscore_read.rb
activerecord-3.2.13.rc2 lib/active_record/attribute_methods/deprecated_underscore_read.rb
activerecord-3.2.13.rc1 lib/active_record/attribute_methods/deprecated_underscore_read.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/deprecated_underscore_read.rb
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/deprecated_underscore_read.rb
active_mailer-0.0.3 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/deprecated_underscore_read.rb
activerecord-3.2.12 lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-0.9.1.beta.3 vendor/bundle/gems/activerecord-3.2.11/lib/active_record/attribute_methods/deprecated_underscore_read.rb
devise_sociable-0.1.0 vendor/bundle/gems/activerecord-3.2.11/lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-0.9.1.beta vendor/bundle/gems/activerecord-3.2.11/lib/active_record/attribute_methods/deprecated_underscore_read.rb
activerecord-3.2.11 lib/active_record/attribute_methods/deprecated_underscore_read.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.10/lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-0.9.0 vendor/bundle/gems/activerecord-3.2.9/lib/active_record/attribute_methods/deprecated_underscore_read.rb
activerecord-3.2.10 lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-rolls-0.2.0 vendor/bundle/gems/activerecord-3.2.7/lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/activerecord-3.2.8/lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-rolls-0.2.0 vendor/bundle/gems/activerecord-3.2.8/lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-rolls-0.2.0 vendor/bundle/gems/activerecord-3.2.9/lib/active_record/attribute_methods/deprecated_underscore_read.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/activerecord-3.2.7/lib/active_record/attribute_methods/deprecated_underscore_read.rb