| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve the derivation of HABTM join table name to take account of nesting.
It now takes the table names of the two models, sorts them lexically and
then joins them, stripping any common prefix from the second table name.
Some examples:
Top level models
(Category <=> Product)
Old: categories_products
New: categories_products
Top level models with a global table_name_prefix
(Category <=> Product)
Old: site_categories_products
New: site_categories_products
Nested models in a module without a table_name_prefix method
(Admin::Category <=> Admin::Product)
Old: categories_products
New: categories_products
Nested models in a module with a table_name_prefix method
(Admin::Category <=> Admin::Product)
Old: categories_products
New: admin_categories_products
Nested models in a parent model
(Catalog::Category <=> Catalog::Product)
Old: categories_products
New: catalog_categories_products
Nested models in different parent models
(Catalog::Category <=> Content::Page)
Old: categories_pages
New: catalog_categories_content_pages
Also as part of this commit the validity checks for HABTM assocations have
been moved to ActiveRecord::Reflection One side effect of this is to move when
the exceptions are raised from the point of declaration to when the association
is built. This is consistant with other association validity checks.
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
Reason: If metadata is not cached extra sql statements
will be executed, which causes failures tests with assert_queries().
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Several tests that passed when run in the order they are loaded
by rake test were failing when run in different sequences due to
problems with the implementation of assert_queries and
assert_no_queries as well as incorrect assumptions made about
how many queries might be executed by a database adapter in
various cases.
|
| | |
|
| |
| |
| |
| | |
Merge commit 6f1d9d00ffd9d411b2bd488da4eb92b7e2fd972e
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|\
| |
| |
| |
| | |
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
|
| | |
|
| |
| |
| |
| | |
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
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/test/cases/associations/belongs_to_associations_test.rb
|
| | | |
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
Get a properly aliased_table_name, when we use a polymorphic association.
|
| | | |
|
|/ /
| |
| |
| | |
(as described in #5667)
|
|/ |
|
| |
|
|
|
|
| |
correct
|
|\
| |
| | |
Fix has_many through associations when mass_assignment_sanitizer is strict
|
| | |
|
| |
| |
| |
| | |
:strict
|
|/
|
|
| |
update the records we retrive from the association
|
|
|
|
| |
builder
|
|\
| |
| | |
Don't instantiate two objects in collection proxy / find_or_instantiate_by
|
| | |
|