Sha256: 5c29c7d9fabea379cb1badf9da46e737b4879297ba49876b520fb81eca08f8b9

Contents?: true

Size: 764 Bytes

Versions: 193

Compression:

Stored size: 764 Bytes

Contents

module ActiveRecord
  module AttributeMethods
    module BeforeTypeCast
      extend ActiveSupport::Concern

      included do
        attribute_method_suffix "_before_type_cast"
      end

      def read_attribute_before_type_cast(attr_name)
        @attributes[attr_name]
      end

      # Returns a hash of attributes before typecasting and deserialization.
      def attributes_before_type_cast
        @attributes
      end

      private

      # Handle *_before_type_cast for method_missing.
      def attribute_before_type_cast(attribute_name)
        if attribute_name == 'id'
          read_attribute_before_type_cast(self.class.primary_key)
        else
          read_attribute_before_type_cast(attribute_name)
        end
      end
    end
  end
end

Version data entries

193 entries across 162 versions & 15 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.22.5/lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.22.5 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.22.4 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.22.3 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.22.2 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.22.1 lib/active_record/attribute_methods/before_type_cast.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.22 lib/active_record/attribute_methods/before_type_cast.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.12/lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.21 lib/active_record/attribute_methods/before_type_cast.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/attribute_methods/before_type_cast.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/activerecord-3.2.18/lib/active_record/attribute_methods/before_type_cast.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/activerecord-3.2.18/lib/active_record/attribute_methods/before_type_cast.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/attribute_methods/before_type_cast.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.18/lib/active_record/attribute_methods/before_type_cast.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.18/lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.20 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.19 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.18 lib/active_record/attribute_methods/before_type_cast.rb
activerecord-3.2.17 lib/active_record/attribute_methods/before_type_cast.rb