| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|\
| |
| | |
Associations now raises `ArgumentError` on name conflicts. Closes #13217.
|
| |
| |
| |
| |
| | |
Dangerous association names conflicts include instance or class
methods already defined by `ActiveRecord::Base`.
|
|/ |
|
|\
| |
| | |
Let `unscope` ignore non Arel scope.where_values
|
| | |
|
|\ \
| |/
|/| |
Fix regression on .select method
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was a common pattern:
```
query = author.posts.select(:title)
connection.select_one(query)
```
However `.select` returns a ActiveRecord::AssociationRelation, which has
the bind information, so we can use that to get the right sql query.
Also fix select_rows on postgress and sqlite3 that were not using the binds
[fixes #7538]
[fixes #12017]
[related #13731]
[related #12056]
|
| |
| |
| |
| |
| |
| | |
This behavior is only work out-of-box with minitest and also add a
downside to run after each test case, even if we don't used the travel
or travel_to methods
|
|\ \
| | |
| | | |
find_in_batches should not mutate its argument
|
| | | |
|
| |/
|/|
| |
| |
| |
| |
| | |
There is no gain in `referencing` tables that are not used for preloading.
Furthermore it will break if polymorphic associations are invloved. This
is because `references_eager_loaded_tables?` uses all `reference_values`
to decide wether to `eager_load` or `preload`.
|
| | |
|
|/
|
|
| |
after loading it from YAML - fixes #13861
|
|\
| |
| |
| |
| |
| |
| |
| | |
`find_in_batches` now returns an `Enumerator`
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/batches.rb
|
| |
| |
| |
| |
| |
| | |
so that it
can be chained with other `Enumerable` methods.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Dangerous name conflicts includes instance or class method conflicts
with methods defined within `ActiveRecord::Base` but not its ancestors,
as well as conflicts with methods generated by other enums on the same
class.
Fixes #13389.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Similar to dangerous attribute methods, a scope name conflict is
dangerous if it conflicts with an existing class method defined within
`ActiveRecord::Base` but not its ancestors.
See also #13389.
*Godfrey Chan*, *Philippe Creux*
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before:
>> ActiveRecord::Base.respond_to?(:find_by_something)
NoMethodError: undefined method `abstract_class?' for Object:Class
After:
>> ActiveRecord::Base.respond_to?(:find_by_something)
=> false
|
| |
| |
| |
| |
| |
| | |
- fixes #13788
As per the documentation at lock!, if the :lock option is a string it should use the given SQL to generate the lock statement.
|
| |
| |
| |
| |
| |
| |
| | |
With this we can write `Model#select(:aliased)`, `Model#order(:aliased)`,
`Model#reoder(aliased: :desc)`, etc.
Supplementary work to 54122067acaad39b277a5363c6d11d6804c7bf6b.
|
| | |
|
|\ \
| | |
| | | |
Add docs about behaviour of replacing a has_one associate object.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
previous one is deleted even if the new one
doesn't get persisted to database.
Fixes #13197 . [ci skip]
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Hopefully make it easier to debug errors. e.g
Before:
RuntimeError:
unscope(where: "deleted_at") failed: unscoping String is unimplemented.
After:
RuntimeError:
unscope(where: "deleted_at") failed: unscoping String "'t'='t'" is unimplemented.
|
|\ \
| | |
| | | |
Fix `ActiveRecord::RecordNotFound` error message with custom primary key
|
| | | |
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Better ActiveRecord hierarchy for Dirty and others
|
| | |
| | |
| | | |
Move serialization dirty into serialization.rb
|
| | | |
|
|\ \ \
| | | |
| | | | |
Remove duplicate merge
|
| | | | |
|
| | | | |
|
| | | | |
|
|/ / /
| | |
| | |
| | | |
Need to define #reset on CollectionProxy.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit fixes two regressions introduced in cafe31a078 where
newly created finder methods #second, #third, #forth, and #fifth
caused a NoMethodError error on reload associations and where we
were pulling the wrong element out of cached associations.
Examples:
some_book.authors.reload.second
# Before
# => NoMethodError: undefined method 'first' for nil:NilClass
# After
# => #<Author id: 2, name: "Sally Second", ...>
some_book.first.authors.first
some_book.first.authors.second
# Before
# => #<Author id: 1, name: "Freddy First", ...>
# => #<Author id: 1, name: "Freddy First", ...>
# After
# => #<Author id: 1, name: "Freddy First", ...>
# => #<Author id: 2, name: "Sally Second", ...>
Fixes #13783.
|
|\ \ \
| |/ /
|/| |
| | |
| | |
| | |
| | | |
Implement the Dirty API with the Enum feature correctly.
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This will make simpler to compare if the values changed in the
save_changed_attribute method.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
To make this possible we have to override the save_changed_attribute
hook.
|
| | |
| | |
| | |
| | | |
This will make easier to hook on this feature to customize the behavior
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since Rails 4.0, we add an ORDER BY in the `first` method to ensure consistent
results among different database engines. But for singular associations this
behavior is not needed since we will have one record to return. As this
ORDER BY option can lead some performance issues we are removing it for singular
associations accessors.
Fixes #12623.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This fixes a bug where `select(:id)` combined with `joins()` raised:
```
ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: id:
SELECT id, authors.author_address_id
FROM "posts"
INNER JOIN "authors"
ON "authors"."id" = "posts"."author_id"
ORDER BY posts.id LIMIT 3
```
The `select_values` are still String and Symbols because other parts (mainly calculations.rb)
rely on that fact.
/cc @tenderlove
|
| | | |
|