| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to build associated records for owners which has not been saved
need to get where values to use as default attributes.
But for new record owner uses `ActiveRecord::NullRelation` which
override `where_values_hash` to return empty hash stub.
`where_values_hash` is not used to invoke any sql query, but good to
build others chains (even will be never executed) like:
```ruby
post = Post.new
admin_comment = post.admin_comments.build
assert_equal 'Admin', admin_comment.author
```
Closes #11376, #11676, #11675
|
| |
|
| |
|
|
|
|
| |
string with timezone. Closes #12278.
|
|\
| |
| |
| |
| |
| |
| | |
Raising an error when nil is passed to update_attributes.
Conflicts:
activerecord/CHANGELOG.md
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Dump UUID default functions to schema.rb [2nd version]. Fixes #10751.
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixed a bug in when using has_many association with :inverse_of option and UUID primary key.
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
| | | |
| | | |
| | | | |
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
|