aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-02-17 11:29:51 -0700
committerSean Griffin <sean@thoughtbot.com>2015-02-17 13:28:48 -0700
commit4a3cb840b0c992b0f15b66274dfa7de71a38fa03 (patch)
tree12911fe78b638c8328b8c882f02d3d0c35c29134 /activerecord/lib/active_record/type
parentb3fdf9c596e4821e0028472b9c2740fd4d6655c8 (diff)
downloadrails-4a3cb840b0c992b0f15b66274dfa7de71a38fa03.tar.gz
rails-4a3cb840b0c992b0f15b66274dfa7de71a38fa03.tar.bz2
rails-4a3cb840b0c992b0f15b66274dfa7de71a38fa03.zip
`Type#type_cast_from_database` -> `Type#deserialize`
Diffstat (limited to 'activerecord/lib/active_record/type')
-rw-r--r--activerecord/lib/active_record/type/binary.rb2
-rw-r--r--activerecord/lib/active_record/type/helpers/mutable.rb2
-rw-r--r--activerecord/lib/active_record/type/integer.rb2
-rw-r--r--activerecord/lib/active_record/type/serialized.rb2
-rw-r--r--activerecord/lib/active_record/type/value.rb8
5 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/type/binary.rb b/activerecord/lib/active_record/type/binary.rb
index 005a48ef0d..412d387c76 100644
--- a/activerecord/lib/active_record/type/binary.rb
+++ b/activerecord/lib/active_record/type/binary.rb
@@ -23,7 +23,7 @@ module ActiveRecord
end
def changed_in_place?(raw_old_value, value)
- old_value = type_cast_from_database(raw_old_value)
+ old_value = deserialize(raw_old_value)
old_value != value
end
diff --git a/activerecord/lib/active_record/type/helpers/mutable.rb b/activerecord/lib/active_record/type/helpers/mutable.rb
index dc37f4a885..9af39aa9fb 100644
--- a/activerecord/lib/active_record/type/helpers/mutable.rb
+++ b/activerecord/lib/active_record/type/helpers/mutable.rb
@@ -3,7 +3,7 @@ module ActiveRecord
module Helpers
module Mutable # :nodoc:
def type_cast_from_user(value)
- type_cast_from_database(type_cast_for_database(value))
+ deserialize(type_cast_for_database(value))
end
# +raw_old_value+ will be the `_before_type_cast` version of the
diff --git a/activerecord/lib/active_record/type/integer.rb b/activerecord/lib/active_record/type/integer.rb
index 2ab2402dfd..b8cbf6114d 100644
--- a/activerecord/lib/active_record/type/integer.rb
+++ b/activerecord/lib/active_record/type/integer.rb
@@ -16,7 +16,7 @@ module ActiveRecord
:integer
end
- def type_cast_from_database(value)
+ def deserialize(value)
return if value.nil?
value.to_i
end
diff --git a/activerecord/lib/active_record/type/serialized.rb b/activerecord/lib/active_record/type/serialized.rb
index 6c6c520048..67aac58b1d 100644
--- a/activerecord/lib/active_record/type/serialized.rb
+++ b/activerecord/lib/active_record/type/serialized.rb
@@ -11,7 +11,7 @@ module ActiveRecord
super(subtype)
end
- def type_cast_from_database(value)
+ def deserialize(value)
if default_value?(value)
value
else
diff --git a/activerecord/lib/active_record/type/value.rb b/activerecord/lib/active_record/type/value.rb
index 7338920f3b..d6b61ead63 100644
--- a/activerecord/lib/active_record/type/value.rb
+++ b/activerecord/lib/active_record/type/value.rb
@@ -18,7 +18,7 @@ module ActiveRecord
# Value#type_cast and Value#cast_value.
#
# +value+ The raw input, as provided from the database.
- def type_cast_from_database(value)
+ def deserialize(value)
type_cast(value)
end
@@ -73,11 +73,11 @@ module ActiveRecord
#
# or
#
- # - pass +raw_old_value+ to Value#type_cast_from_database and compare it to
+ # - pass +raw_old_value+ to Value#deserialize and compare it to
# +new_value+
#
# +raw_old_value+ The original value, before being passed to
- # +type_cast_from_database+.
+ # +deserialize+.
#
# +new_value+ The current value, after type casting.
def changed_in_place?(raw_old_value, new_value)
@@ -94,7 +94,7 @@ module ActiveRecord
private
# Convenience method. If you don't need separate behavior for
- # Value#type_cast_from_database and Value#type_cast_from_user, you can override
+ # Value#deserialize and Value#type_cast_from_user, you can override
# this method instead. The default behavior of both methods is to call
# this one. See also Value#cast_value.
def type_cast(value) # :doc: