| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Fair connection pool2
Conflicts:
activerecord/test/cases/associations/eager_test.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The core of this fix is a threadsafe, fair Queue class. It is
very similar to Queue in stdlib except that it supports waiting
with a timeout.
The issue this solves is that if several threads are contending for
database connections, an unfair queue makes is possible that a thread
will timeout even while other threads successfully acquire and release
connections. A fair queue means the thread that has been waiting the
longest will get the next available connection.
This includes a few test fixes to avoid test ordering issues that
cropped up during development of this patch.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I found the next issue between CollectionAssociation `delete`
and `destroy`.
class Person < ActiveRecord::Base
has_many :pets
end
person.pets.destroy(1)
# => OK, returns the destroyed object
person.pets.destroy("2")
# => OK, returns the destroyed object
person.pets.delete(1)
# => ActiveRecord::AssociationTypeMismatch
person.pets.delete("2")
# => ActiveRecord::AssociationTypeMismatch
Adding support for deleting with a fixnum or string like
`destroy` method.
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
things
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
correct
|
|
|
|
| |
builder
|
|\
| |
| | |
Don't instantiate two objects in collection proxy / find_or_instantiate_by
|
| | |
|
| | |
|
|\ \
| | |
| | | |
reflection test fixed
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
ids_reader method fixed, test added to has_many association (for PostgreSQL)
|
| |/ |
|
| | |
|
|/ |
|
| |
|
|
|
|
| |
present but the record is unsaved
|
|
|
|
| |
Preserve SELECT columns on the COUNT for finder_sql when possible
|
| |
|
|
|
|
| |
Fix: habtm doesn't respect select query method
|
|
|
|
| |
mutating the array. Fixes #3020.
|
|
|
|
| |
HasManyAssociation#inverse_updates_counter_cache?. Fixes #2755, where a counter cache could be decremented twice as far as it was supposed to be.
|
|
|
|
|
| |
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.
|
|
|
|
| |
not a single line of SQL should be sent to the database, not even stuff that is ignored by assert_queries. The argument being that if you write assert_no_queries, you really do not want there to be any queries.
|
| |
|
|
|
|
| |
are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database.
|
| |
|
|
|
|
| |
RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
|
|
|
|
| |
issue where the collection proxies were not consistent
|
| |
|
|
|
|
| |
an abstract superclass. Fixes #552.
|
|
|
|
|
|
|
| |
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.
|