diff options
author | Xavier Noria <fxn@hashref.com> | 2014-10-28 16:17:33 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2014-10-28 16:35:24 -0700 |
commit | b3bfa361c503e107aff4dee5edf79bd7fd3d3725 (patch) | |
tree | 4a9725f90708b45ff85e68b01335bbf94ee35f17 /activerecord/lib/active_record/attribute_methods | |
parent | 777142d3a7b9ea36fcc8562613749299ac6dc243 (diff) | |
download | rails-b3bfa361c503e107aff4dee5edf79bd7fd3d3725.tar.gz rails-b3bfa361c503e107aff4dee5edf79bd7fd3d3725.tar.bz2 rails-b3bfa361c503e107aff4dee5edf79bd7fd3d3725.zip |
let's warn with heredocs
The current style for warning messages without newlines uses
concatenation of string literals with manual trailing spaces
where needed.
Heredocs have better readability, and with `squish` we can still
produce a single line.
This is a similar use case to the one that motivated defining
`strip_heredoc`, heredocs are super clean.
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/serialization.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index cc82d00b20..e5ec5ddca5 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/string/filters' + module ActiveRecord module AttributeMethods module Serialization @@ -51,8 +53,10 @@ module ActiveRecord end def serialized_attributes - ActiveSupport::Deprecation.warn "`serialized_attributes` is deprecated " \ - "without replacement, and will be removed in Rails 5.0." + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `serialized_attributes` is deprecated without replacement, and will + be removed in Rails 5.0. + MSG @serialized_attributes ||= Hash[ columns.select { |t| t.cast_type.is_a?(Type::Serialized) }.map { |c| |