| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
Simply use its own method because `CollectionProxy` inherits `Relation`.
|
|
|
|
| |
Simply use its own methods because `CollectionProxy` inherits `Relation`.
|
|
|
|
|
|
|
| |
`length` is delegated to `records` (`load_target`) by
`ActiveRecord::Delegation`.
https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/relation/delegation.rb#L38
|
|\
| |
| |
| |
| | |
kamipo/remove_unnecessary_select_for_collection_proxy
Remove unnecessary `select` method for `CollectionProxy`
|
| |
| |
| |
| |
| |
| |
| | |
Currently `CollectionProxy` inherits `Relation` and `Relation` includes
`QueryMethods`. This method is completely duplicated.
https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/relation/query_methods.rb#L271-L275
|
|/
|
|
|
| |
Currently `CollectionProxy` inherits `Relation` therefore we can use
its own methods rather than delegating to collection association.
|
|\
| |
| | |
`pluck` should use `records` (`load_target`) when `loaded?` is true
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
`#second`, `#third`, etc finder methods was added in 03855e790de2224519f55382e3c32118be31eeff.
But the signature of these methods is inconsistent with the original
finder methods. And also the signature of `#first` and `#last` methods
is different from the original. This commit fixes the inconsistency.
|
|/
|
|
|
| |
`#first`, `#second`, ..., `#last` methods respects dirty target. But
`#take` doesn't respect it. This commit fixes the inconsistent behavior.
|
|\
| |
| | |
`FinderMethods` uses `records` (`load_target`) when `loaded?` is true
|
| | |
|
|/ |
|
|
|
|
|
|
| |
association scope
Fixes #25732.
|
| |
|
|
|
|
|
|
|
|
| |
Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005
* Forward compat with new unified Integer class in Ruby 2.4+.
* Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3.
* Drops needless Fixnum distinction in docs, preferring Integer.
|
| |
|
|
|
|
|
|
| |
Clarifying this separation and enforcing relation immutability is the
culmination of the previous efforts to remove the mutator method
delegations.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The focus of this change is to make the API more accessible.
References to method and classes should be linked to make it easy to
navigate around.
This patch makes exzessiv use of `rdoc-ref:` to provide more readable
docs. This makes it possible to document `ActiveRecord::Base#save` even
though the method is within a separate module
`ActiveRecord::Persistence`. The goal here is to bring the API closer to
the actual code that you would write.
This commit only deals with Active Record. The other gems will be
updated accordingly but in different commits. The pass through Active
Record is not completely finished yet. A follow up commit will change
the spots I haven't yet had the time to update.
/cc @fxn
|
| |
|
|
|
|
| |
skip]
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Improve the guide about `has_many` `collection.clear` to indicate
the behavior for each dependent strategy according to
`collection.delete_all`.
Based on #17179, I changed the `collection.delete` docs to also
clarify the default strategy for each `hm` and `hm:t` associations.
Fixes #20170.
|
|
|
|
|
|
|
|
| |
- CollectionProxy#clear method calls delete_all so the SQL is directly
run into the database.
- So the updated_at column of the object on which its run is not
updated.
- Closes #17161
|
| |
|
| |
|
| |
|
|
|
|
| |
Fixes #18237
|
|
|
|
|
|
|
| |
Construction of relations can be a hotspot, we don't want to create one
of these in the constructor. This also allows us to do more expensive
things in the predicate builder's constructor, since it's created once
per AR::Base subclass
|
|
|
|
|
|
|
|
|
|
|
| |
For detailed testing of behavior see:
https://gist.github.com/eileencodes/5b0a2fe011dcff6203fe
This shows destroy_all always destroys records and fires callbacks.
It will never use nullify or delete_all
delete_all's behavior varies greatly based on `hm` vs `hm:t` and deletion
strategy.
|
| |
|
|\
| |
| | |
[ci skip] Updated documentation syntax of block parameter for rdoc
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
| |
This method no longer returns an array of all records that
have been removed. Correct documentation to reflect this change.
See issue 14546
|
|
|
|
|
|
| |
CollectionProxy should be able to reuse the behavior (methods) of its parent class,
but with its own state. This change allows CollectionProxy to use the arel object
corresponding to its association's scope.
|
| |
|
|
|
|
| |
Need to define #reset on CollectionProxy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes two regressions introduced in cafe31a078 where
newly created finder methods #second, #third, #forth, and #fifth
caused a NoMethodError error on reload associations and where we
were pulling the wrong element out of cached associations.
Examples:
some_book.authors.reload.second
# Before
# => NoMethodError: undefined method 'first' for nil:NilClass
# After
# => #<Author id: 2, name: "Sally Second", ...>
some_book.first.authors.first
some_book.first.authors.second
# Before
# => #<Author id: 1, name: "Freddy First", ...>
# => #<Author id: 1, name: "Freddy First", ...>
# After
# => #<Author id: 1, name: "Freddy First", ...>
# => #<Author id: 2, name: "Sally Second", ...>
Fixes #13783.
|
| |
|
| |
|
|\
| |
| |
| |
| | |
derikson/collection_proxy_select_with_multiple_args
Change CollectionProxy#select to take the same arguments as ActiveRecord::select
|