diff options
Diffstat (limited to 'activerecord/lib/active_record/properties.rb')
-rw-r--r-- | activerecord/lib/active_record/properties.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/properties.rb b/activerecord/lib/active_record/properties.rb index a5d724de0e..39c39ad9ff 100644 --- a/activerecord/lib/active_record/properties.rb +++ b/activerecord/lib/active_record/properties.rb @@ -64,7 +64,19 @@ module ActiveRecord # Returns an array of column objects for the table associated with this class. def columns - @columns ||= add_user_provided_columns(connection.schema_cache.columns(table_name)) + @columns ||= add_user_provided_columns(connection.schema_cache.columns(table_name)).each do |column| + if Type::DecimalWithoutScale === column.cast_type + ActiveSupport::Deprecation.warn <<-MESSAGE.strip_heredoc + Decimal columns with 0 scale being automatically treated as integers + is deprecated, and will be removed in a future version of Rails. If + you'd like to keep this behavior, add + + property :#{column.name}, Type::Integer.new + + to your #{name} model. + MESSAGE + end + end end # Returns a hash of column objects for the table associated with this class. |