aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_assignment.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-24 06:43:03 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-24 07:11:54 -0600
commit40e33ff9fc81f919b143576180b9202794a37e91 (patch)
tree741c649ed10528ba45324d0f1196ef1d115e0990 /activerecord/lib/active_record/attribute_assignment.rb
parent9ac1ce11ad9ec22157d2e542437c5c5cccaf58fe (diff)
downloadrails-40e33ff9fc81f919b143576180b9202794a37e91.tar.gz
rails-40e33ff9fc81f919b143576180b9202794a37e91.tar.bz2
rails-40e33ff9fc81f919b143576180b9202794a37e91.zip
Silence warning in test
We still had one file using `column_for_attribute` when it could return nil, causing deprecation warnings in the tests.
Diffstat (limited to 'activerecord/lib/active_record/attribute_assignment.rb')
-rw-r--r--activerecord/lib/active_record/attribute_assignment.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb
index 833ffa158b..2887db3bf7 100644
--- a/activerecord/lib/active_record/attribute_assignment.rb
+++ b/activerecord/lib/active_record/attribute_assignment.rb
@@ -115,7 +115,7 @@ module ActiveRecord
end
class MultiparameterAttribute #:nodoc:
- attr_reader :object, :name, :values, :column
+ attr_reader :object, :name, :values, :cast_type
def initialize(object, name, values)
@object = object
@@ -126,8 +126,8 @@ module ActiveRecord
def read_value
return if values.values.compact.empty?
- @column = object.column_for_attribute(name)
- klass = column ? column.klass : nil
+ @cast_type = object.type_for_attribute(name)
+ klass = cast_type.klass
if klass == Time
read_time
@@ -141,7 +141,7 @@ module ActiveRecord
private
def instantiate_time_object(set_values)
- if object.class.send(:create_time_zone_conversion_attribute?, name, column)
+ if object.class.send(:create_time_zone_conversion_attribute?, name, cast_type)
Time.zone.local(*set_values)
else
Time.send(object.class.default_timezone, *set_values)
@@ -151,7 +151,7 @@ module ActiveRecord
def read_time
# If column is a :time (and not :date or :datetime) there is no need to validate if
# there are year/month/day fields
- if column.type == :time
+ if cast_type.type == :time
# if the column is a time set the values to their defaults as January 1, 1970, but only if they're nil
{ 1 => 1970, 2 => 1, 3 => 1 }.each do |key,value|
values[key] ||= value