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 95b86e57a6 Change how AttributeSet::Builder receives its defaults
There are two concerns which are both being combined into one here, but
both have the same goal. There are certain attributes which we want to
always consider initialized. Previously, they were handled separately.
The primary key (which is assumed to be backed by a database column)
needs to be initialized, because there is a ton of code in Active Record
that assumes `foo.id` will never raise. Additionally, we want attributes
which aren't backed by a database column to always be initialized, since
we would never receive a database value for them.

Ultimately these two concerns can be combined into one. The old
implementation hid a lot of inherent complexity, and is hard to optimize
from the outside. We can simplify things significantly by just passing
in a hash.

This has slightly different semantics from the old behavior, in that
`Foo.select(:bar).first.id` will return the default value for the
primary key, rather than `nil` unconditionally -- however, the default
value is always `nil` in practice.
2017-11-27 14:06:51 -07:00
..
associations Provide arguments to RecordNotFound 2017-11-25 21:57:04 +03:00
attribute_methods Move Attribute and AttributeSet to ActiveModel 2017-11-09 14:29:39 -05:00
coders
connection_adapters Drop mysql2 version less than 0.4.3 to guarantee fork safety (#31244) 2017-11-28 05:09:00 +09:00
fixture_set
locale
locking Rase when calling lock! in a dirty record 2017-10-23 12:50:46 -04:00
migration Merge pull request #30510 from yhirano55/add_nodoc_to_activerecord 2017-11-25 10:04:08 -05:00
railties Add environment as dependency of load_config (#31135) 2017-11-14 13:54:58 +09:00
relation Provide arguments to RecordNotFound 2017-11-25 21:57:04 +03:00
scoping Prevent extra spawn to make klass.all faster (#29009) 2017-11-20 06:24:50 +09:00
tasks Merge pull request #30414 from bogdanvlviv/clear-mysql_database_tasks 2017-11-09 17:21:37 -05:00
type
type_caster
validations remove incorrect statement about serializable transactions 2017-10-25 19:52:21 -07:00
aggregations.rb
association_relation.rb
associations.rb Remove unused classes 2017-11-03 10:18:33 +09:00
attribute_assignment.rb
attribute_decorators.rb
attribute_methods.rb try using regexes 2017-11-09 22:42:15 +10:30
attributes.rb Move Attribute and AttributeSet to ActiveModel 2017-11-09 14:29:39 -05:00
autosave_association.rb
base.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
callbacks.rb Remove deprecated :if and :unless string filter for callbacks 2017-10-23 12:51:04 -04:00
collection_cache_key.rb Ensure apply_join_dependency for collection_cache_key if eager-loading is needed 2017-11-06 03:34:15 +09:00
connection_handling.rb Flush idle database connections 2017-11-26 15:12:50 +10:30
core.rb Prevent extra spawn to make klass.all faster (#29009) 2017-11-20 06:24:50 +09:00
counter_cache.rb removed unnecessary returns 2017-10-28 17:20:38 +09:00
define_callbacks.rb Use tt in doc for ActiveRecord [ci skip] 2017-08-27 14:01:29 +09:00
dynamic_matchers.rb
enum.rb
errors.rb Add new error class QueryCanceled which will be raised when canceling statement due to user request (#31235) 2017-11-27 11:54:59 +09:00
explain.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
explain_registry.rb
explain_subscriber.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
fixtures.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
gem_version.rb Preparing for 5.2.0.beta1 release 2017-11-27 14:50:03 -05:00
inheritance.rb Update links to use https instead of http [ci skip] 2017-08-22 11:43:33 +09:00
integration.rb
internal_metadata.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
legacy_yaml_adapter.rb Move Attribute and AttributeSet to ActiveModel 2017-11-09 14:29:39 -05:00
log_subscriber.rb
migration.rb Update incorrect backtick usage in RDoc to teletype 2017-11-22 14:45:51 -05:00
model_schema.rb Change how AttributeSet::Builder receives its defaults 2017-11-27 14:06:51 -07:00
nested_attributes.rb Add update_only example to AR nested attributes doc [ci_skip] 2017-10-03 08:54:10 -03:00
no_touching.rb Use tt in doc for ActiveRecord [ci skip] 2017-08-27 14:01:29 +09:00
null_relation.rb
persistence.rb Avoid creating extra relation and build_arel in _create_record and _update_record (#29999) 2017-11-17 03:12:57 +09:00
query_cache.rb Merge pull request #28869 from eugeneius/query_cache_all_pools 2017-11-17 23:32:57 +10:30
querying.rb allow Arel.sql() for pluck 2017-11-09 22:37:23 +10:30
railtie.rb Flush idle database connections 2017-11-26 15:12:50 +10:30
readonly_attributes.rb
reflection.rb source_type_scope should respect correct table alias 2017-10-30 22:06:12 +09:00
relation.rb Revert "Merge pull request #31006 from rails/kamipo/ordinal_methods_should_respect_loaded_records" 2017-11-26 10:22:54 -05:00
result.rb
runtime_registry.rb
sanitization.rb Merge pull request #27947 from mastahyeti/unsafe_raw_sql 2017-11-14 23:30:45 +10:30
schema.rb Prefer formatted number as schema version [ci skip] 2017-08-21 02:05:45 +09:00
schema_dumper.rb Implement PostgreSQL::SchemaDumper#extensions 2017-10-25 15:53:09 +00:00
schema_migration.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
scoping.rb Add :nodoc: to activerecord [ci skip] 2017-09-03 00:23:01 +09:00
secure_token.rb
serialization.rb
statement_cache.rb Passing klass to StatementCache.new 2017-08-04 02:27:50 +09:00
store.rb
suppressor.rb
table_metadata.rb Changed join_fk private method to join_foreign_key public method 2017-08-09 11:18:27 +05:30
timestamp.rb
touch_later.rb
transactions.rb Remove deprecated :if and :unless string filter for callbacks 2017-10-23 12:51:04 -04:00
translation.rb
type.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
type_caster.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
validations.rb [Active Record] require => require_relative 2017-10-21 22:48:27 +09:00
version.rb