| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\
| |
| |
| |
| | |
ActiveRecord find_in_batches should work without logger
When I set logger to nil both methods from Batches module find_in_batches or find_each should work anyway.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In 94924dc32baf78f13e289172534c2e71c9c8cade the internal default_scope
implementation has changed making it simpler to follow, meaning that the
old usage of with_default_scope has been removed.
With that, order_values was the same argument for both calls to
find_first_with_limit, so remove it and use the existent attribute
for the sake of clarity/simplification.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previous implementation was necessary in order to support stuff
like:
class Post < ActiveRecord::Base
default_scope where(published: true)
scope :ordered, order("created_at")
end
If we didn't evaluate the default scope at the last possible moment
before sending the SQL to the database, it would become impossible to
do:
Post.unscoped.ordered
This is because the default scope would already be bound up in the
"ordered" scope, and therefore wouldn't be removed by the
"Post.unscoped" part.
In 4.0, we have deprecated all "eager" forms of scopes. So now you must
write:
class Post < ActiveRecord::Base
default_scope { where(published: true) }
scope :ordered, -> { order("created_at") }
end
This prevents the default scope getting bound up inside the "ordered"
scope, which means we can now have a simpler/better/more natural
implementation of default scoping.
A knock on effect is that some things that didn't work properly now do.
For example it was previously impossible to use #except to remove a part
of the default scope, since the default scope was evaluated after the
call to #except.
|
|\ \
| | |
| | |
| | | |
When .find_each is called without a block, return an Enumerator.
|
| |/
| |
| |
| | |
This lets us do things like call: .find_each.with_index
|
|/
|
|
|
|
|
|
| |
fixes #10669
While joining_values special treatment is given to string values.
By flattening the array it ensures that string values are detected
as strings and not arrays.
|
|\
| |
| | |
Refactored ActiveRecord `first` method to get rid of duplication.
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
guides/source/upgrading_ruby_on_rails.md
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
recommended
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | | |
Rather than raising ThrowResult when construct_limited_ids_conditions comes up empty, set the relation to NullRelation and rely on its results.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
up empty, set the relation to NullRelation and rely on its results.
This will help avoid errors like 2fcafee250ee2, because in most cases NullRelation will do the right thing. Minor bonus is avoiding the use of exceptions for flow control.
|
| | | |
| | | |
| | | |
| | | | |
failing to construct_limited_ids_condition.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Use grep instead of select with === in QueryMethods
|
| | | | |
| | | | |
| | | | |
| | | | | |
pass block directly to grep
|
|/ / / / |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
the time
|
| |/ /
|/| | |
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
Conflicts:
activesupport/lib/active_support/callbacks.rb
|
| | | |
|
| | |
| | |
| | |
| | | |
#join_associations.
|
| | |
| | |
| | |
| | |
| | |
| | | |
is always a new object.
Thanks to the #except we call at the top of the method.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
to pair it closely with its motivation.
|
| | |
| | |
| | |
| | | |
used at all on non-postgres adapters.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The combination of a :uniq => true association and the #distinct call
in #construct_limited_ids_condition combine to create invalid SQL, because
we're explicitly selecting DISTINCT, and also sending #distinct on to AREL,
via the relation#distinct_value.
Rather than build a select distinct clause in #construct_limited_ids_condition,
I set #distinct! and pass just the columns into the select statement.
This requires introducing a #columns_for_distinct method to return the
select columns but not the statement itself.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In order to fix #10421 I need to enable merge to take an option
so that relations could be merged without making the last where
condition to win.
That fix would forever reside in 4-0-stable branch and would not be
merged to master since using scope without lambda has been deprecated.
In this commit I have extracted code into a method and I think it
makes code look better. Hence the request to merge it in both
master and 4-0-stable.
If there is any concern then this code can be merged only in
4-0-stable and that would be fine too.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When using symbol keys, ActiveRecord will now translate aliased attribute names to the actual column name used in the database:
With the model
class Topic
alias_attribute :heading, :title
end
The call
Topic.where(heading: 'The First Topic')
should yield the same result as
Topic.where(title: 'The First Topic')
This also applies to ActiveRecord::Relation::Calculations calls such as `Model.sum(:aliased)` and `Model.pluck(:aliased)`.
This will not work with SQL fragment strings like `Model.sum('DISTINCT aliased')`.
Github #7839
*Godfrey Chan*
|
| | |
|
| |
| |
| |
| | |
should be empty.
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
guides/source/action_mailer_basics.md
|