| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
Also unify the format of code example output. Only use `# =>` if the
actual return value is described. Otherwise simply use `#`.
Conflicts:
activerecord/lib/active_record/relation/query_methods.rb
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #21563.
The `name` argument of `add_references` was both used to generate the
column name `<name>_id` and as the target table for the foreign key
`name.pluralize`.
It's primary purpose is to define the column name. In cases where the
`to_table` of the foreign key is different than the column name we
should be able to specify it individually.
|
|
|
|
|
| |
Current master branch includes many schema dumping improvements.
It extract these features to the appropriate files.
|
|\
| |
| |
| | |
Remove deprecated pg_dump -i flag
|
| | |
|
| |
| |
| |
| |
| | |
Current master branch includes many schema creation improvements in
MySQL. It extract these features to the appropriate file.
|
|/
|
|
|
| |
Current master branch includes many schema definition improvements in
MySQL. It extract these features to the appropriate file.
|
|\
| |
| |
| | |
Make AR#increment! and #decrement! concurrency-safe
|
| | |
|
|\ \
| | |
| | | |
Modify the scope method documentation
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Adds a paragraph to the documentation of the `ActiveRecord::Scoping::Named.scope` method,
explaining that the method is intended to return an ActiveRecord::Relation object to be
composable with other scopes.
In the case that in the case that `nil` or `false` are returned, the method returns
an `all` relation instead.
This unexpected behaviour is mentioned in #19249 #14256 #21465 and #21882 and wasn't
documented at all. This commit adds this documentation.
|
| | |
| | |
| | |
| | | |
`require 'active_support/core_ext/string/filters'` was added in b3bfa36. However, it is no longer needed from 3ae981814.
|
|/ /
| |
| |
| |
| |
| | |
`pk_and_sequence_for` is implemented for PG and MySQL adapters (not
implemented for Sqlite3 adapter). But MySQL adapters are not using
`pk_and_sequence_for` already.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Any gems or libraries which do work with serialization or YAML will
ultimately need to compare these objects (albeit indirectly) to ensure
correctness. These will likely never get used internally (as they're
slow), but we should still expose them for others.
|
| | |
|
|\ \
| | |
| | | |
No need to declare ActiveRecord::Attributes::Type
|
| | | |
|
|\ \ \
| | | |
| | | | |
Skip _select! call unless needed for preloader
|
| | | |
| | | |
| | | |
| | | |
| | | | |
the default scope will select all fields. removing this
improves performance and reduces String creation.
|
|\ \ \ \
| | | | |
| | | | | |
Docs: Update options for add_reference
|
| | | | |
| | | | |
| | | | | |
[ci skip]
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* before
```
people = Person.where(group: 'expert')
people.update(group: 'masters')
Note: Updating a large number of records will run a
UPDATE query for each record, which may cause a performance
issue. So if it is not needed to run callbacks for each update, it is
preferred to use <tt>update_all</tt> for updating all records using
a single query.
```
* after
```
people = Person.where(group: 'expert')
people.update(group: 'masters')
```
Note: Updating a large number of records will run an
UPDATE query for each record, which may cause a performance
issue. So if it is not needed to run callbacks for each update, it is
preferred to use <tt>update_all</tt> for updating all records using
a single query.
|
|\ \ \ \ \ |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
`alias :migrations_path= :migrations_paths=`, so
`migrations_path = some_string` is correct.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
documentations [ci skip]
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Wrong usage of 'a' in docs fixed [ci skip]
|
| | | | | | | |
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | | |
to reduce allocation of same object
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
For reads, we never need to construct this object. The double `defined?`
check is to avoid errors in tests
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Fix AC::Parameters not being sanitized for query methods.
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
There were a few places where I missed a `create` vs `new`
before_type_cast check, and the semantics of `reload` became wrong.
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We can skip the allocation of a full `AttributeSet` by changing the
semantics of how we structure things. Instead of comparing two separate
`AttributeSet` objects, and `Attribute` is now a singly linked list of
every change that has happened to it. Since the attribute objects are
immutable, to apply the changes we simply need to copy the head of the
list.
It's worth noting that this causes one subtle change in the behavior of
AR. When a record is saved successfully, the `before_type_cast` version
of everything will be what was sent to the database. I honestly think
these semantics make more sense, as we could have just as easily had the
DB do `RETURNING *` and updated the record with those if we had things
like timestamps implemented at the DB layer.
This brings our performance closer to 4.2, but we're still not quite
there.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Allow fixtures YAML files to set the model class in the file itself
Conflicts:
activerecord/CHANGELOG.md
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Currently, `set_fixture_class` is only available using the
`TestFixtures` concern and it is ignored for `rake db:fixtures:load`.
Using the correct model class, it is possible for the fixture load
to also load the associations from the YAML files (e.g., `:belongs_to`
and `:has_many`).
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
I'm looking to move towards a tree-like structure for dirty checking
that involves an attribute holding onto the attribute that it was
created from. This means that `changed?` can be fully encapsulated on
that object. Since the objects are immutable, in `changes_applied`, we
can simply perform a shallow dup, instead of a deep one.
I'm not sure if that will actually end up in a performance boost, but
I'd like to semantically separate these concepts regardless
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The external uses of this method have been removed, and I'd like to
internally re-use that name, as I'm planning to encapsulate `changed?`
into the attribute object itself.
|
| | | | | | |
| | | | | | |
| | | | | | | |
`ActiveRecord::Associations::JoinDependency` now it’s own class` and `ActiveRecord::Associations::ThroughAssociationScope` doesn’t exists
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Fix minor docs [ci skip]
|
| | | | | | | | |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Fix `ActiveRecord::RecordNotFound` error message with custom primary …
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
skip]
|
|\ \ \ \ \ \ \ \ \
| |_|/ / / / / / /
|/| | | | | | | | |
[ci skip] Update docs of `AR::Sanitization`
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
* add % style prepared statement and string examples for
`sanitize_sql_for_conditions`
* add array and string examples for `sanitize_sql_for_assignment`
* add examples for `sanitize_sql_like`
* add % style prepared statement example for `sanitize_sql_array`
* align spaces of exampl code
|
| |_|_|_|_|_|_|/
|/| | | | | | | |
|