| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
The fix commited in e2a070c was returning the `new_target`, as
a try to return whatever user replaced association with. The
problem is, the resulting association target may be ordered
differently. In such case we want to return the target that
will be later used for that association.
|
| |
|
|
|
|
| |
Bug #6289
|
|\
| |
| |
| |
| | |
JonRowe/patch_uniq_has_and_belongs_to_many_when_already_loaded
When Active Record has already loaded a unique association `.size` returns the wrong number.
|
| |
| |
| |
| | |
of the uniq array
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
| |
* Remove unused association_class method.
* Remove a unnecessary assignment.
* Move @updated to BelongsToAssociation that only reference this instance variable.
* Reset @stale_state at the reset method. I think this place is right place.
|
|
|
|
| |
correct
|
| |
|
| |
|
| |
|
|
|
|
|
| |
when fetching ids for a collection, bypass preloading
to avoid the unnecessary performance overhead
|
| |
|
|
|
|
| |
present but the record is unsaved
|
|
|
|
| |
Preserve SELECT columns on the COUNT for finder_sql when possible
|
|
|
|
|
|
| |
English to
American English(according to Weber)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
conditions and includes,
when condtions references tables from includes.
Test fail because of invalid sql:
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: comments.id:
SELECT "posts".id FROM "posts" INNER JOIN "readers" ON "posts"."id" = "readers"."post_id"
WHERE "readers"."person_id" = 1 AND (comments.id is null)
Bug described in github#925
This commit will revert fix from https://github.com/rails/rails/commit/3436fdfc12d58925e3d981e0afa61084ea34736c , but tests is ok.
Bug described in #6569 ticket.
|
|
|
|
|
| |
In order to make CollectionAssociation behave closer to Array
Add the ability to pass block to #find method just like Array#find does.
|
|
|
|
| |
before_initialize callback of the record runs. Fixes #1842.
|
| |
|
|
|
|
| |
are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database.
|
| |
|
|
|
|
| |
Fixes #1360.
|
|
|
|
| |
the branch so I cannot just merge it.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
The build_association method was added as an API for plugins
to hook into in 1398db0. This commit restores this API and the
ability to override class.new to return a subclass based on
a virtual attribute in the attributes hash.
|
|
|
|
|
| |
* It is not necessary to subtract 'id' from the list of copied attributes because record and mem_record are equal, so therefore their id attributes are also equal (so there is no harm in copying it, and this reduces the complexity of the code)
* It is not necessary to intersect the attribute names, since record and mem_record are equal, so they have the same id and class, so they have the same columns in the database. If record has non-column attributes then it seems reasonable to also copy them onto mem_record (though I am not sure what situation this would ever happen in)
|
|
|
|
| |
attributes when copying, rather than using the assignment method
|
| |
|
|
|
|
| |
scoped.all, just do scoped.all.
|
|
|
|
| |
can't see a way that it would happen ever)
|
| |
|
| |
|
|
|
|
| |
scoped.scope_for_create. Fixes #481.
|
| |
|
|
|
|
|
| |
Wrapping each Record.associations.build in a transaction is going to
make several unneeded queries. Reverting this commit also fixes #479.
|
|
|
|
| |
security options (:as and :without_protection) in build, create and create! methods.
|
|
|
|
| |
query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs
|
|
|
|
| |
AssociationScope class which is capable of building a scope for any association.
|
|
|
|
| |
callbacks etc) rather than calling a whole bunch of methods with rather long names.
|
|
|
|
| |
'reflection.options' with 'options'. Also add through_options and source_options methods for through associations.
|
|
|
|
| |
accessing the instance variables
|
|
manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
|