提交 aff73e09 编写于 作者: S Sean Griffin

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.
上级 52434e9a
......@@ -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.
......
module ActiveRecord
module ConnectionAdapters
module Type
class Binary < Value
class Binary < Value # :nodoc:
def type
:binary
end
......
module ActiveRecord
module ConnectionAdapters
module Type
class Boolean < Value
class Boolean < Value # :nodoc:
def type
:boolean
end
......
module ActiveRecord
module ConnectionAdapters
module Type
class Date < Value
class Date < Value # :nodoc:
def type
:date
end
......
module ActiveRecord
module ConnectionAdapters
module Type
class DateTime < Value
class DateTime < Value # :nodoc:
include TimeValue
def type
......
module ActiveRecord
module ConnectionAdapters
module Type
class Decimal < Value
class Decimal < Value # :nodoc:
include Numeric
def type
......
module ActiveRecord
module ConnectionAdapters
module Type
class Float < Value
class Float < Value # :nodoc:
include Numeric
def type
......
module ActiveRecord
module ConnectionAdapters
module Type
class Integer < Value
class Integer < Value # :nodoc:
include Numeric
def type
......
module ActiveRecord
module ConnectionAdapters
module Type
class String < Value
class String < Value # :nodoc:
def type
:string
end
......
......@@ -3,7 +3,7 @@
module ActiveRecord
module ConnectionAdapters
module Type
class Text < String
class Text < String # :nodoc:
def type
:text
end
......
module ActiveRecord
module ConnectionAdapters
module Type
class Value
class Value # :nodoc:
attr_reader :precision, :scale, :limit
# Valid options are +precision+, +scale+, and +limit+.
......
module ActiveRecord
module Properties
module Properties # :nodoc:
extend ActiveSupport::Concern
Type = ConnectionAdapters::Type
......@@ -64,19 +64,7 @@ def property(name, cast_type)
# 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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册