From aff73e094640b19cb1bdc975082be7b4767bf4bf Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Tue, 27 May 2014 13:08:13 -0700 Subject: [PATCH] Remove AR Properties from the public API Making this part of the public API was premature, let's make it private again while I continue to work on the surrounding code. --- activerecord/CHANGELOG.md | 6 ------ .../connection_adapters/type/binary.rb | 2 +- .../connection_adapters/type/boolean.rb | 2 +- .../connection_adapters/type/date.rb | 2 +- .../connection_adapters/type/date_time.rb | 2 +- .../connection_adapters/type/decimal.rb | 2 +- .../connection_adapters/type/float.rb | 2 +- .../connection_adapters/type/integer.rb | 2 +- .../connection_adapters/type/string.rb | 2 +- .../connection_adapters/type/text.rb | 2 +- .../connection_adapters/type/value.rb | 2 +- activerecord/lib/active_record/properties.rb | 16 ++-------------- 12 files changed, 12 insertions(+), 30 deletions(-) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 736745c3cd..8ddefddcfe 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -6,12 +6,6 @@ *arthurnn* -* Add a properties API to allow custom types and type casting behavior - to be specified. Will enable many edge cases to be deprecated, and - allow for additional interesting features in the future. - - *Sean Griffin* - * Fix has_and_belongs_to_many public reflection. When defining a has_and_belongs_to_many, internally we convert that to two has_many. But as `reflections` is a public API, people expect to see the right macro. diff --git a/activerecord/lib/active_record/connection_adapters/type/binary.rb b/activerecord/lib/active_record/connection_adapters/type/binary.rb index 60afe44de1..4b2d1a66e0 100644 --- a/activerecord/lib/active_record/connection_adapters/type/binary.rb +++ b/activerecord/lib/active_record/connection_adapters/type/binary.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Binary < Value + class Binary < Value # :nodoc: def type :binary end diff --git a/activerecord/lib/active_record/connection_adapters/type/boolean.rb b/activerecord/lib/active_record/connection_adapters/type/boolean.rb index 0d97379189..2337bdd563 100644 --- a/activerecord/lib/active_record/connection_adapters/type/boolean.rb +++ b/activerecord/lib/active_record/connection_adapters/type/boolean.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Boolean < Value + class Boolean < Value # :nodoc: def type :boolean end diff --git a/activerecord/lib/active_record/connection_adapters/type/date.rb b/activerecord/lib/active_record/connection_adapters/type/date.rb index e8becbe1f4..1e7205fd0b 100644 --- a/activerecord/lib/active_record/connection_adapters/type/date.rb +++ b/activerecord/lib/active_record/connection_adapters/type/date.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Date < Value + class Date < Value # :nodoc: def type :date end diff --git a/activerecord/lib/active_record/connection_adapters/type/date_time.rb b/activerecord/lib/active_record/connection_adapters/type/date_time.rb index 64f5d05301..c34f4c5a53 100644 --- a/activerecord/lib/active_record/connection_adapters/type/date_time.rb +++ b/activerecord/lib/active_record/connection_adapters/type/date_time.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class DateTime < Value + class DateTime < Value # :nodoc: include TimeValue def type diff --git a/activerecord/lib/active_record/connection_adapters/type/decimal.rb b/activerecord/lib/active_record/connection_adapters/type/decimal.rb index e93906ba19..ac5af4b963 100644 --- a/activerecord/lib/active_record/connection_adapters/type/decimal.rb +++ b/activerecord/lib/active_record/connection_adapters/type/decimal.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Decimal < Value + class Decimal < Value # :nodoc: include Numeric def type diff --git a/activerecord/lib/active_record/connection_adapters/type/float.rb b/activerecord/lib/active_record/connection_adapters/type/float.rb index f2427d2dfa..28111e9d8e 100644 --- a/activerecord/lib/active_record/connection_adapters/type/float.rb +++ b/activerecord/lib/active_record/connection_adapters/type/float.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Float < Value + class Float < Value # :nodoc: include Numeric def type diff --git a/activerecord/lib/active_record/connection_adapters/type/integer.rb b/activerecord/lib/active_record/connection_adapters/type/integer.rb index 596f4de2a8..8e6a509b5b 100644 --- a/activerecord/lib/active_record/connection_adapters/type/integer.rb +++ b/activerecord/lib/active_record/connection_adapters/type/integer.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Integer < Value + class Integer < Value # :nodoc: include Numeric def type diff --git a/activerecord/lib/active_record/connection_adapters/type/string.rb b/activerecord/lib/active_record/connection_adapters/type/string.rb index 471f949e09..55f0e1ee1c 100644 --- a/activerecord/lib/active_record/connection_adapters/type/string.rb +++ b/activerecord/lib/active_record/connection_adapters/type/string.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class String < Value + class String < Value # :nodoc: def type :string end diff --git a/activerecord/lib/active_record/connection_adapters/type/text.rb b/activerecord/lib/active_record/connection_adapters/type/text.rb index 61095ebb38..ee5842a3fc 100644 --- a/activerecord/lib/active_record/connection_adapters/type/text.rb +++ b/activerecord/lib/active_record/connection_adapters/type/text.rb @@ -3,7 +3,7 @@ require 'active_record/connection_adapters/type/string' module ActiveRecord module ConnectionAdapters module Type - class Text < String + class Text < String # :nodoc: def type :text end diff --git a/activerecord/lib/active_record/connection_adapters/type/value.rb b/activerecord/lib/active_record/connection_adapters/type/value.rb index 60b443004c..415ef0aee9 100644 --- a/activerecord/lib/active_record/connection_adapters/type/value.rb +++ b/activerecord/lib/active_record/connection_adapters/type/value.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module Type - class Value + class Value # :nodoc: attr_reader :precision, :scale, :limit # Valid options are +precision+, +scale+, and +limit+. diff --git a/activerecord/lib/active_record/properties.rb b/activerecord/lib/active_record/properties.rb index 39c39ad9ff..a25c1cec58 100644 --- a/activerecord/lib/active_record/properties.rb +++ b/activerecord/lib/active_record/properties.rb @@ -1,5 +1,5 @@ module ActiveRecord - module Properties + module Properties # :nodoc: extend ActiveSupport::Concern Type = ConnectionAdapters::Type @@ -64,19 +64,7 @@ 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)).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 + @columns ||= add_user_provided_columns(connection.schema_cache.columns(table_name)) end # Returns a hash of column objects for the table associated with this class.