1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record
Sean Griffin 158c7eb1d6 rm Column#cast_type
The type from the column is never used, except when being passed to the
attributes API. While leaving the type on the column wasn't necessarily
a bad thing, I worry that it's existence there implies that it is
something which should be used.

During the design and implementation process of the attributes API,
there have been plenty of cases where getting the "right" type object
was hard, but I had easy access to the column objects. For any
contributor who isn't intimately familiar with the intents behind the
type casting system, grabbing the type from the column might easily seem
like the "correct" thing to do.

As such, the goal of this change is to express that the column is not
something that should be used for type casting. The only places that are
"valid" (at the time of this commit) uses of acquiring a type object
from the column are fixtures (as the YAML file is going to mirror the
database more closely than the AR object), and looking up the type
during schema detection to pass to the attributes API

Many of the failing tests were removed, as they've been made obsolete
over the last year. All of the PG column tests were testing nothing
beyond polymorphism. The Mysql2 tests were duplicating the mysql tests,
since they now share a column class.

The implementation is a little hairy, and slightly verbose, but it felt
preferable to going back to 20 constructor options for the columns. If
you are git blaming to figure out wtf I was thinking with them, and have
a better idea, go for it. Just don't use a type object for this.
2015-02-03 15:02:18 -07:00
..
associations Correct errors in counter cache updating 2015-02-03 13:28:07 -07:00
attribute_methods Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
attribute_set Remove AttributeSet#initialized_keys 2015-01-31 17:29:35 -07:00
coders Provide a better error message for unsupported classes in serialize 2014-12-27 19:49:09 -07:00
connection_adapters rm Column#cast_type 2015-02-03 15:02:18 -07:00
fixture_set
locale Move required error message and changelog to Active Record 2015-02-01 10:31:54 -02:00
locking Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
migration
railties Replace deprecated #load_schema with #load_schema_for. 2014-12-23 12:07:15 +01:00
relation Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
scoping
serializers Remove most type related predicates from Column 2015-01-30 11:42:54 -07:00
tasks Fix syntax warning 2014-12-23 09:13:56 -07:00
type Move integer range validation to never raise on assignment 2015-01-23 14:30:23 -07:00
type_caster Remove most uses of Column#cast_type 2015-01-30 10:38:44 -07:00
validations Fix validations on child record when record parent has validate: false 2015-02-01 16:03:49 -08:00
aggregations.rb Improve the performance of reading attributes 2014-11-18 15:20:19 -08:00
association_relation.rb Inject the PredicateBuilder into the Relation instance 2014-12-26 13:53:56 -07:00
associations.rb [ci skip] add note about has_one :through and :dependent 2015-02-01 15:53:44 +03:00
attribute.rb Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
attribute_assignment.rb Move method to private section 2015-01-26 08:17:53 -02:00
attribute_decorators.rb Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
attribute_methods.rb Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
attribute_set.rb Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
attributes.rb Rename user_provided_types to something more meaningful 2015-02-02 11:08:01 -07:00
autosave_association.rb Always perform validations on nested attribute associations 2015-01-30 07:27:20 -07:00
base.rb Add has_secure_token to Active Record 2015-01-04 11:31:37 -05:00
callbacks.rb Deprecate false as the way to halt AR callbacks 2015-01-02 15:31:56 -08:00
connection_handling.rb Check for Rails.env instead of Rails 2014-12-25 16:34:28 +03:00
core.rb Fix Issue #15549, unbounded memory growth when saving records that have any after_create callbacks (or any associations, which makes after_create callbacks for you) 2015-02-01 14:01:54 -08:00
counter_cache.rb Improve consistency of counter caches updating in memory 2015-01-26 12:37:29 -07:00
dynamic_matchers.rb Remove support to activerecord-deprecated_finders 2015-01-02 12:06:24 -03:00
enum.rb Improve the performance of reading attributes 2014-11-18 15:20:19 -08:00
errors.rb Extracted ActiveRecord::AttributeAssignment to ActiveModel::AttributesAssignment 2015-01-23 23:43:22 +02:00
explain.rb
explain_registry.rb
explain_subscriber.rb
fixtures.rb Use Module#include instead of send :include, since now is a public method [ci skip] 2015-01-31 22:19:48 -05:00
gem_version.rb Start Rails 5 development 🎉 2014-11-28 15:00:06 -02:00
inheritance.rb Attribute assignment and type casting has nothing to do with columns 2015-01-31 19:42:38 -07:00
integration.rb
log_subscriber.rb Remove Relation#bind_params 2015-01-27 16:10:03 -07:00
migration.rb Do not check only for the Rails constant 2015-01-02 00:45:09 -03:00
model_schema.rb rm Column#cast_type 2015-02-03 15:02:18 -07:00
nested_attributes.rb Always perform validations on nested attribute associations 2015-01-30 07:27:20 -07:00
no_touching.rb Add nodoc to touch at no_touching.rb 2014-12-29 14:14:46 -03:00
null_relation.rb Bring the implementation of Relation#or up to speed 2015-01-28 14:35:03 -07:00
persistence.rb add destroyed records to the currend transaction 2015-02-01 14:20:36 -08:00
query_cache.rb
querying.rb Added #or to ActiveRecord::Relation 2015-01-28 13:35:55 -07:00
railtie.rb do not trigger AR lazy load hook before initializers ran. 2014-11-25 18:16:41 +01:00
readonly_attributes.rb Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
reflection.rb remove deprecated support to preload instance-dependent associaitons. 2015-01-05 11:44:14 +01:00
relation.rb Remove Relation#bind_params 2015-01-27 16:10:03 -07:00
result.rb Revert "Improve performance of AR object instantiation" 2014-11-14 14:30:39 -07:00
runtime_registry.rb
sanitization.rb Stop passing a column to quote when finding by AR models 2015-01-10 15:45:46 -07:00
schema.rb
schema_dumper.rb Improve a dump of the primary key support. 2014-12-29 09:19:21 +09:00
schema_migration.rb
scoping.rb
secure_token.rb Fix Typo SecureToken for schema sample [ci skip] 2015-01-15 16:06:01 +01:00
serialization.rb Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
statement_cache.rb Remove Relation#bind_params 2015-01-27 16:10:03 -07:00
store.rb Fix type case of "validations" and word-wrap from #17954 [ci skip] 2014-12-08 08:36:04 -08:00
table_metadata.rb Use an Attribute object to represent a bind value 2015-01-27 12:07:06 -07:00
timestamp.rb Fix warning: `*' interpreted as argument prefix 2014-12-28 16:05:53 +09:00
transactions.rb add destroyed records to the currend transaction 2015-02-01 14:20:36 -08:00
translation.rb
type.rb Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger. 2014-12-12 00:35:48 +09:00
type_caster.rb Extract an explicit type caster class 2014-12-29 11:07:56 -07:00
validations.rb AR specific length validator to respect marked_for_destruction. 2014-12-30 10:25:58 +01:00
version.rb