| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Integration tests are inside protected_attributes test suite.
Fixes #15496
Fixes rails/protected_attributes#35
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fix regression on eager loading association based on SQL query rather than existing column.
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
than existing column.
Fixes #15480.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Reflection has a `belongs_to?` method. Instead of checking for
`macro == :belongs_to` throughout the source reuse existing
method.
I also bumped `foreign_key_present?` method onto on line because
the `belongs_to?` makes it shorter than other longer lines in
the same class.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Fix polymorphic to check for `options[:polymorphic]` instead of
`options.key? :polymorphic` and then reuse the method `polymorphic?`
method instead of constantly checking the same `options[:polymorphic]`.
|
|\ \ \
| | | |
| | | | |
Correctly alias table names when joining more than once
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Skip if the association was already loaded.
|
| | |_|/
| |/| | |
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fix habtm reflection
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/counter_cache.rb
activerecord/lib/active_record/reflection.rb
activerecord/test/cases/reflection_test.rb
|
|\ \ \
| | | |
| | | |
| | | | |
Fix polymorphic eager load with foreign_key as String.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The foreign_key could be `String` and just doing `owners_map[owner_key]`
could return `nil`.
To prevent this bug, we should `to_s` both keys if their types are
different.
Fixes #14734.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
Fixes #14824.
|
|/ /
| |
| |
| |
| |
| | |
When delete or destroy is called on all records nothing
is deleted or destroyed. Intead of running through the code and still
not deleteing anything, we should early return
|
| |
| |
| |
| |
| |
| | |
cc:
https://github.com/rails/rails/commit/a11e2fcff8cdc9691b977d8330abe63024f8c732#commitcomment-6353614
and 0369dbf
|
| | |
|
| |
| |
| |
| |
| | |
parent_name is a string of nil, never a blank string so we don't need to
use presence.
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Fix how to compute class name on habtm namespaced.
Conflicts:
activerecord/CHANGELOG.md
|
| | |
| | |
| | |
| | |
| | |
| | | |
Thank's for @laurocaetano for the help with tests. :smiley:
Fixes #14709
|
| | |
| | |
| | |
| | | |
this change was unneccsary as nothing was gained from it
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Rename delete_all_records because this name better describes
what the method is doing. We can then remove :all from the
hm:t version and pull out the unoptimized call to load_target
in delete_records and pass it directly.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Refactor delete_count method to only handle delete_all or nullify/nil cases
and not destroy and switch to if/else rather than case statement. This
refactoring allows removal of :all symbol usage.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Refactor by creating two methods delete_all_records and delete_records
to be called by delete_all and delete (or destroy) respectively.
This reduces the number of conditionals required to handle _how_
records get deleted.
The new delete_count method handles how scope is applied to which
delete action.
A delete_all_records method also has to be called in has_many_through
association because of how the methods are chained. This will be
refactored later on.
|
| |
| |
| |
| |
| |
| |
| | |
Closes #15024.
These operations happen before instances are created.
The current behavior is misleading and can result in broken behavior.
|
| |
| |
| |
| |
| | |
HABTM should fall back to using the normal CollectionAssociation's size calculation if the collection is not cached or loaded.
This addresses both #14913 and #14914 for master.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Rewrite to avoid 'we'/'you', add missing period, and keep lines at 80 chars. Cheers :)
Improve readability with help from @senny
[ci skip]
|
|\ \
| | |
| | | |
Refactored AssociationScope#get_bind_values
|
| | |
| | |
| | |
| | | |
Added #join_id_for(owner) to reflection to avoid accessing the source_macro
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
Now that delete_all with destroy or delete_all dependency behave
the same we no longer need this conditional. This means we can remove
the new delete_all_with_dependency method I added and go straight
to delete_records from delete_all, passing :all and the dependent
directly.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Nullify (or nil dependency) was doing the same thing delete_all
was doing in issue #14546, creating a large IN statement if
the association was loaded. Loaded and not loaded associations
should behave the same. The IN statement is also not great because
it's inefficient.
|
| |
| |
| |
| |
| |
| |
| | |
After reviewing this code I realized the conditional that was
there previously was basically saying if the dependency is not
delete all. This is a better, cleaner, and clearer way to write
this method.
|
| |
| |
| |
| |
| | |
Now that we have a new method delete_all_with_dependency this
coupled conditional is no longer needed.
|
| |
| |
| |
| |
| |
| | |
The delete method is very coupled with delete all even
though only a portion of the conditionals apply. Decoupling
this will make the code easier to understand and manipulate.
|
|\ \
| | |
| | | |
Fix to use custom join table in habtm
|
| | |
| | |
| | |
| | |
| | |
| | | |
When used a custom join_table name on a habtm, rails was not saving it
on Reflections. This causes a problem when rails loads fixtures, because
it uses the reflections to set database with fixtures.
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* master: (28 commits)
move AR length validation tests into separate test-case.
No need for trailing slash on migration path.
reset `@arel` when modifying a Relation in place.
PostgreSQL Timestamps always map to `:datetime`.
[ci skip] Improve formatting and yml
Fix a typo in the doc of forty_two AR FinderMethod
Improve readability of contributing to rails guide. [ci skip]
Precompile the image we're referencing, too.
`ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
Fixed an issue with migrating legacy json cookies.
Correct comment [ci skip]
Perfer to define methods instead of calling test
Fix syntax error
Add CHANGELOG entry for #14757 [ci skip]
Fix run-on sentences and improve grammar [skip ci]
Add test for using ActionView::Helpers::FormHelper.label with block and html
select! renamed to avoid name collision Array#select!
Rearrange deck chairs on the titanic. Organize connection handling test cases.
Change favicon_link_tag helper mimetype from image/vnd.microsoft.icon to image/x-icon.
ActionController::Renderers documentation fix
...
|
| | |
| | |
| | |
| | | |
/cc @tenderlove
|
| |\ \
| | | |
| | | | |
Fix behavior of select! to be consistent with select #14752
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes #14752
Select mimics the block interface of arrays, but does not mock the
block interface for select!. This change moves the api to be a
private method, _select!.
|
| |\ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Properly handle scoping with has_many :through. Fixes #14537.
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/cases/associations/has_many_through_associations_test.rb
|
| | | | |
| | | | |
| | | | |
| | | | | |
instance_eval directly.
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|