| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Makes it consistent with Relation. Can't see a use for this.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This helps bring the interfaces of CollectionProxy and Relation closer
together, and reduces the delegation backflips we need to perform.
For example, first_or_create is defined thus:
class ActiveRecord::Relation
def first_or_create(...)
first || create(...)
end
end
If CollectionProxy < Relation, then post.comments.first_or_create will
hit the association's #create method which will actually add the new record
to the association, just as post.comments.create would.
With the previous delegation, post.comments.first_or_create expands to
post.comments.scoped.first_or_create, where post.comments.scoped has no
knowledge of the association.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Change CollectionProxy#method_missing to use scoped.public_send, to
avoid a problem described in issue #2508 when trying to use class
methods with names like "open", that clash with private kernel methods.
Also changed the dynamic matcher instantiator to send straight to
scoped, to avoid another roundtrip to method_missing.
|
|
|
|
| |
Base#scoped
|
|
|
|
|
|
| |
if they are not defined or delegated.
In this way, we have a performance boost invoking some array methods
which are not defined in CollectionAssociation.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
mutating the array. Fixes #3020.
|
|
|
|
| |
by association extensions to access information about the association. This replaces proxy_owner etc with proxy_association.owner.
|
| |
|
| |
|
| |
|
|
|
|
| |
issue where the collection proxies were not consistent
|
| |
|
|
|
|
| |
CollectionProxy with deprecations. Fixes #1148.
|
|
|
|
|
|
|
| |
- adds tests for find_or_create_by and find_or_initialize_by on has_many associations
- changes the behavior of ActiveRecord::Associations::CollectionProxy#method_missing to differ to
ActiveRecord::FinderMethods#find_or_instantiator_by_attributes for arg processing and saving so
find_or_create_by's api on associations will be consistent w/ the api for model classes.
|
|
|
|
| |
query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs
|
|
manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
|