| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | | |
UUID primary key.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
or even be numbers, so sorting by id doesn't make sense. Please use `sort_by`
and specify the attribute you wish to sort with. For example, change:
Post.all.to_a.sort
to:
Post.all.to_a.sort_by(&:id)
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Collapse where constraints to the Arel::Nodes::And node
Conflicts:
activerecord/CHANGELOG.md
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In order to remove duplication with joining arel where constraints with
`AND`, all constraints on `build_arel` are collapsed into one head node: `Arel::Nodes::And`
Closes: #11963
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Deprecate the delegation of Array bang methods in ActiveRecord::Delegation
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/cases/relation_test.rb
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The primary means of returning results for Array bang methods is to modify
the array in-place. When you call these methods on a relation, that
array is created, modified, and then thrown away. Only the secondary
return value is exposed to the caller.
Removing this delegation is a straight-forward way to reduce user error
by forcing callers to first explicitly call #to_a in order to expose
the array to be acted on by the bang method.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Make CollectionAssociation first/last with integer fetch with query
Conflicts:
activerecord/CHANGELOG.md
|
| | |/ / / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
When first or last is called with an integer on an unloaded association,
the entire collection is loaded. This differs surprisingly from the
behavior of Relation#first/last, which translate the call into a limit
query. For large collections this can make a big difference in
performance.
Change CollectionAssociation#fetch_first_or_last_using_find? to make
this kind of call delegate to Relation.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
[ci skip]
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Allow Relation#from to accept other relations with bind values.
Conflicts:
activerecord/CHANGELOG.md
|
| |/ / / / / |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
When the adapter is with prepared statement disabled and the binds array
is not empty the connection adapter will try to set the binds values and
will fail. Now we are checking if the adapter has the prepared statement
disabled.
Fixes #12023
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Avoid empty transaction from setting has_one association on new record.
Conflicts:
activerecord/CHANGELOG.md
|
| | | | | | | |
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | | |
The original code ignores the `false` value because `false.blank? # => true`.
|
|/ / / / / |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Re-use order arguments pre-processing for reorder
|
| | | | |
| | | | |
| | | | |
| | | | | |
be consistent.
|
| | | | | |
|
|/ / / / |
|
| | | |
| | | |
| | | |
| | | | |
add changelog entry for #11945
|
| | | |
| | | |
| | | |
| | | | |
Closes #11899.
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
In order that set attribute should not be bang method
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
records, and don't bother updating the association if the update is going to be rejected anyway.
This requires adding a `skip_callbacks` argument to `#add_to_target`
so that we don't call the callbacks multiple times in this case,
which is functionally an application of existing association data,
rather than an addition of a new record to the association.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Issue #1: :before_add callback is called when nested attributes assignment assigns to existing record if the association is not yet loaded
Issue #2: Nested Attributes assignment does not affect the record in the association target when callback triggers loading of the association
|
| | | |
| | | |
| | | |
| | | |
| | | | |
If 'enable_extension' is used in a migration's 'change' method, use
'disable_extension' on down migration (and vice-versa).
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
[ci skip]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
If the `db/` directory is not present on a remote machine it will blow up in unexpected ways with error messages that do not indicate there is a missing directory:
```
SQLite3::CantOpenException: unable to open database file
```
This PR checks to see if a directory exists for the sqlite3 file and if not creates it for you.
This PR is an alternative to #11692 as suggested by @josevalim
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Removed redundant xml override from pg adapter
|
| | | | |
| | | | |
| | | | |
| | | | | |
Closes: #11706
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
Conflicts:
activerecord/CHANGELOG.md
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
order on the old ones
The previous behavior added a major backward incompatibility since it
impossible to have a upgrade path without major changes on the
application code.
We are taking the most conservative path to be consistent with the idea
of having a smoother upgrade on Rails 4.
We are reverting the behavior for what was in Rails 3.x and,
if needed, we will implement a new API to prepend the order clauses in
Rails 4.1.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This adds the ability for rails apps or gems to have granular control
over how a domain object is converted to sql. One simple use case would
be to add support for Regexp. Another simple case would be something
like the following:
class DateRange < Struct.new(:start, :end)
def include?(date)
(start..end).cover?(date)
end
end
class DateRangePredicate
def call(attribute, range)
attribute.in(range.start..range.end)
end
end
ActiveRecord::PredicateBuilder.register_handler(DateRange,
DateRangePredicate.new)
More complex cases might include taking a currency object and converting
it from EUR to USD before performing the query.
By moving the existing handlers to this format, we were also able to
nicely refactor a rather nasty method in PredicateBuilder.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Some adapters require column information to do their job properly.
By enforcing the provision of the column for this internal method
we ensure that those using adapters that require column information
will always get the proper behavior.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This includes fixing typos in changelog, removing a deprecated
mocha/setup test require, and preferring the `column_for_attribute`
accessor over direct access to the columns_hash in the new code.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When calling quote_value the underlying connection sometimes requires
more information about the column to properly return the correct quoted
value.
I ran into this issue when using optimistic locking in JRuby and the
activerecord-jdbcmssql-adapter. In SQLSever 2000, we aren't allowed to
insert a integer into a NVARCHAR column type so we need to format it as
N'3' if we want to insert into the NVARCHAR type. Unfortuantely, without
the column type being passed the connection adapter cannot properly return
the correct quote value because it doesn't know to return N'3' or '3'.
This patch is fairly straight forward where it just passes in the column
type into the quote_value, as it already has the ability to take in the column,
so it can properly handle at the connection level.
I've added the tests required to make sure that the quote_value method
is being passed the column type so that the underlying connection can
determine how to quote the value.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes #11497
As `ActiveRecord::ConnectionAdapters::ConnectionManagement` middleware does not rescue from Exception (but only from StandardError),
the Connection Pool quickly runs out of connections when multiple erroneous Requests come in right after each other.
Recueing from all exceptions and not just StandardError, fixes this behaviour.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
This reverts commit cb1d07e43926bcec95cb8b4a663ca9889173395a, reversing
changes made to 754a373e301d2df0b12a11083405252722bc8366.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Using the mysql2 adapter, boolean values were sometimes being incorrectly cast
to 't' or 'f'. This changes the cast to match the mysql adapter behavior, ie 1 and 0.
|
| | | | |
|
| | | |
| | | |
| | | | |
for attributes that are columns.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
`rollback_active_record_state!` tries to restore model state on `Exception`
by invoking `restore_transaction_record_state` it decrement deep level by `1`.
After restoring it ensure that states to be cleared
and level decremented by invoking `clear_transaction_record_state`,
which cause the bug: because state already reduced in `restore_transaction_record_state`.
Removed double derement of transaction level
and removed duplicated code which clear transaction state for top level.
|
| |/ /
|/| | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
jetthoughts/11288_remove_extra_queries_for_belongs_to_with_touch
#11288: Removed duplicated touching
Conflicts:
activerecord/CHANGELOG.md
|