| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this commit, if
`ActiveRecord::Base.belongs_to_required_by_default` is set to `true`,
then creating a record through `has_and_belongs_to_many` fails with the
cryptic error message `Left side must exist`. This is because
`inverse_of` isn't working properly in this case, presumably since we're
doing trickery with anonymous classes in the middle.
Rather than following this rabbit hole to try and get `inverse_of` to
work in a case that we know is not publicly supported, we can just turn
off this validation to match the behavior of 4.2 and earlier.
|
|\
| |
| |
| |
| | |
This is a separate commit, as it is not just a changelog conflict. Want
to point out the changes in the code
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
use only object_id instead parent class and parent id
test cases
assert_equal
use table name in references
fix minor problems
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`inverse_of` on through associations was accidently removed/caused to
stop working in commit f8d2899 which was part of a refactoring on
`ThroughReflection`.
To fix we moved `inverse_of` and `check_validity_of_inverse!` to the
`AbstractReflection` so it's available to the `ThroughReflection`
without having to dup any methods. We then need to delegate `inverse_name`
method in `ThroughReflection`. `inverse_name` can't be moved to
`AbstractReflection` without moving methods that set the instance
variable `@automatic_inverse_of`.
This adds a test that ensures that `inverse_of` on a `ThroughReflection`
returns the correct class name, and the correct record for the inverse
relationship.
Fixes #21692
|
| |
|
|
|
|
|
|
|
| |
This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing
changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9.
Seems to be a code merge done by mistake.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our
Relation API is close to SQL terms I renamed `#uniq` to `#distinct`.
There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue
to work. I also updated the documentation to promote the use of `#distinct`.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370.
Conflicts:
activerecord/CHANGELOG.md
It will be deprecated only in 4.0, and removed properly in 4.1.
|
|
|
|
|
|
|
| |
It doesn't serve much purpose now that ActiveRecord::Base.all returns a
Relation.
The code is moved to active_record_deprecated_finders.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't use this:
scope :red, where(color: 'red')
default_scope where(color: 'red')
Use this:
scope :red, -> { where(color: 'red') }
default_scope { where(color: 'red') }
The former has numerous issues. It is a common newbie gotcha to do
the following:
scope :recent, where(published_at: Time.now - 2.weeks)
Or a more subtle variant:
scope :recent, -> { where(published_at: Time.now - 2.weeks) }
scope :recent_red, recent.where(color: 'red')
Eager scopes are also very complex to implement within Active
Record, and there are still bugs. For example, the following does
not do what you expect:
scope :remove_conditions, except(:where)
where(...).remove_conditions # => still has conditions
|
|
|
|
| |
... } rather than instance_eval-ing strings
|
|
|
|
| |
removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
|
|
|
|
| |
Signed-off-by: Joshua Peek <josh@joshpeek.com>
|
|
|
|
|
|
|
|
|
| |
a newline character immediately following 'SELECT' [#2118 state:resolved]""
This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832.
The feature doesn't work on Postgres, so don't test it on Postgres.
Also, Postgres compatibility is irrelevant to the ticket/patch in question.
|
|
|
|
|
|
|
|
| |
newline character immediately following 'SELECT' [#2118 state:resolved]"
This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a.
The tests do not pass for postgresql.
|
|
|
|
|
|
| |
character immediately following 'SELECT' [#2118 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
added to has_many and has_and_belongs_to_many associations.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1028 state:committed]
|
|
|
|
| |
test_find_in_association_with_custom_finder_sql_and_multiple_interpolations
|
|
|
|
|
|
| |
association cannot be saved. Closes #11084.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|