diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-07 15:12:24 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-07 15:12:24 -0300 |
commit | cf94a551dc56141b2b66521a77b9e20b97395979 (patch) | |
tree | 76ed30c0894ec09f85526339bc70fdff3c5481d7 /activerecord/lib | |
parent | 4cf63ce3731a43bd98f7b92b43dcf1be99c0b183 (diff) | |
parent | 3fab9d8821bc73b28a76f27353cab34d49096ad2 (diff) | |
download | rails-cf94a551dc56141b2b66521a77b9e20b97395979.tar.gz rails-cf94a551dc56141b2b66521a77b9e20b97395979.tar.bz2 rails-cf94a551dc56141b2b66521a77b9e20b97395979.zip |
Merge pull request #15558 from sgrif/sg-rename-property
Rename `property` to `attribute`
Conflicts:
activerecord/lib/active_record/attribute_methods/serialization.rb
activerecord/lib/active_record/base.rb
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attributes.rb (renamed from activerecord/lib/active_record/properties.rb) | 12 | ||||
-rw-r--r-- | activerecord/lib/active_record/base.rb | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/properties.rb b/activerecord/lib/active_record/attributes.rb index 48ee42aaca..9c80121d70 100644 --- a/activerecord/lib/active_record/properties.rb +++ b/activerecord/lib/active_record/attributes.rb @@ -1,5 +1,5 @@ module ActiveRecord - module Properties # :nodoc: + module Attributes # :nodoc: extend ActiveSupport::Concern Type = ActiveRecord::Type @@ -10,7 +10,7 @@ module ActiveRecord end module ClassMethods - # Defines or overrides a property on this model. This allows customization of + # Defines or overrides a attribute on this model. This allows customization of # Active Record's type casting behavior, as well as adding support for user defined # types. # @@ -44,7 +44,7 @@ module ActiveRecord # store_listing.price_in_cents # => BigDecimal.new(10.1) # # class StoreListing < ActiveRecord::Base - # property :price_in_cents, Type::Integer.new + # attribute :price_in_cents, Type::Integer.new # end # # # after @@ -53,7 +53,7 @@ module ActiveRecord # Users may also define their own custom types, as long as they respond to the methods # defined on the value type. The `type_cast` method on your type object will be called # with values both from the database, and from your controllers. See - # `ActiveRecord::Properties::Type::Value` for the expected API. It is recommended that your + # `ActiveRecord::Attributes::Type::Value` for the expected API. It is recommended that your # type objects inherit from an existing type, or the base value type. # # class MoneyType < ActiveRecord::Type::Integer @@ -68,12 +68,12 @@ module ActiveRecord # end # # class StoreListing < ActiveRecord::Base - # property :price_in_cents, MoneyType.new + # attribute :price_in_cents, MoneyType.new # end # # store_listing = StoreListing.new(price_in_cents: '$10.00') # store_listing.price_in_cents # => 1000 - def property(name, cast_type, options = {}) + def attribute(name, cast_type, options = {}) name = name.to_s clear_caches_calculated_from_columns # Assign a new hash to ensure that subclasses do not share a hash diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8663544231..e8c067f758 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -20,7 +20,7 @@ require 'active_record/errors' require 'active_record/log_subscriber' require 'active_record/explain_subscriber' require 'active_record/relation/delegation' -require 'active_record/properties' +require 'active_record/attributes' module ActiveRecord #:nodoc: # = Active Record @@ -323,7 +323,7 @@ module ActiveRecord #:nodoc: include Reflection include Serialization include Store - include Properties + include Attributes include AttributeDecorators end |