aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-07 07:09:45 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-07 07:20:25 -0600
commit3fab9d8821bc73b28a76f27353cab34d49096ad2 (patch)
tree9b42b8abf13648468e7197419edc9ec9678c1e30 /activerecord/lib
parent23a751c2e15800c1b4aa96c10d1bfebc56fa30b9 (diff)
downloadrails-3fab9d8821bc73b28a76f27353cab34d49096ad2.tar.gz
rails-3fab9d8821bc73b28a76f27353cab34d49096ad2.tar.bz2
rails-3fab9d8821bc73b28a76f27353cab34d49096ad2.zip
Rename `property` to `attribute`
For consistency with https://github.com/rails/rails/pull/15557
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/attribute_methods/serialization.rb2
-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.rb4
3 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb
index 148fc9eae5..e749311268 100644
--- a/activerecord/lib/active_record/attribute_methods/serialization.rb
+++ b/activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -62,7 +62,7 @@ module ActiveRecord
if type.serialized?
type = type.subtype
end
- property attr_name, Type::Serialized.new(type, coder)
+ attribute attr_name, Type::Serialized.new(type, coder)
# merge new serialized attribute and create new hash to ensure that each class in inheritance hierarchy
# has its own hash of own serialized attributes
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 8b0fffcf06..47de62a59b 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -19,7 +19,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
@@ -322,7 +322,7 @@ module ActiveRecord #:nodoc:
include Reflection
include Serialization
include Store
- include Properties
+ include Attributes
end
ActiveSupport.run_load_hooks(:active_record, Base)