mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
52434e9a51
commit
aff73e0946
12 changed files with 12 additions and 30 deletions
|
@ -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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class Binary < Value
|
||||
class Binary < Value # :nodoc:
|
||||
def type
|
||||
:binary
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class Boolean < Value
|
||||
class Boolean < Value # :nodoc:
|
||||
def type
|
||||
:boolean
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class Date < Value
|
||||
class Date < Value # :nodoc:
|
||||
def type
|
||||
:date
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class DateTime < Value
|
||||
class DateTime < Value # :nodoc:
|
||||
include TimeValue
|
||||
|
||||
def type
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class Decimal < Value
|
||||
class Decimal < Value # :nodoc:
|
||||
include Numeric
|
||||
|
||||
def type
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class Float < Value
|
||||
class Float < Value # :nodoc:
|
||||
include Numeric
|
||||
|
||||
def type
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class Integer < Value
|
||||
class Integer < Value # :nodoc:
|
||||
include Numeric
|
||||
|
||||
def type
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module Type
|
||||
class String < Value
|
||||
class String < Value # :nodoc:
|
||||
def type
|
||||
:string
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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+.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue