| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`add_reference` can very helpfully add a multi-column index when you use
it to add a polymorphic reference. However, the first column in the
index is the `id` column, which is less than ideal.
The [PostgreSQL docs][1] say:
> A multicolumn B-tree index can be used with query conditions that
> involve any subset of the index's columns, but the index is most
> efficient when there are constraints on the leading (leftmost)
> columns.
The [MySQL docs][2] say:
> MySQL can use multiple-column indexes for queries that test all the
> columns in the index, or queries that test just the first column, the
> first two columns, the first three columns, and so on. If you specify
> the columns in the right order in the index definition, a single
> composite index can speed up several kinds of queries on the same
> table.
In a polymorphic relationship, the type column is much more likely to be
useful as the first column in an index than the id column. That is, I'm
more likely to query on type without an id than I am to query on id
without a type.
[1]: http://www.postgresql.org/docs/9.3/static/indexes-multicolumn.html
[2]: http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html
|
|\
| |
| | |
AR Migrations Guide#Foreign Keys: fix wrong table
|
|/
|
| |
[skip ci]
|
|\
| |
| | |
DRY up try/try!
|
| | |
|
|\ \
| |/
|/| |
Secure compare
|
| | |
|
| | |
|
| | |
|
|\ \
| |/
|/| |
|
|/ |
|
|\
| |
| | |
Fix error string raised from AJ enqueue_at for ClassQueueAdapter
|
| | |
|
|\ \
| | |
| | | |
Inline AJ around_perform and around_enqueue in CallbackJob used for tests
|
| |/ |
|
| | |
|
|\ \
| | |
| | | |
Bring try! into parity with try.
|
|/ /
| |
| |
| | |
Based on commit 5e51bdda.
|
|\ \
| | |
| | | |
:nail_care: fix typos in activejob queuing test
|
|/ / |
|
|\ \
| | |
| | | |
fix small typo in routing test
|
|/ / |
|
|\ \
| | |
| | | |
Fix url generation error message
|
| | | |
|
| | | |
|
|\ \ \
| |_|/
|/| | |
Provide more reasoning to not accept cosmetic changes [ci skip]
|
| | | |
|
|\ \ \
| | | |
| | | | |
Activejob cleanups
|
| | | |
| | | |
| | | |
| | | | |
- Remove un-needed require in AJ rescue test.
|
| |/ / |
|
|\ \ \
| | | |
| | | | |
Remove duplicate 'select' database statement
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The `select` method has the same definition in almost all database
adapters, so it can be moved from the database-specific adapters
(PostgreSQl, MySQL, SQLite) to the abstract `database_statement`:
```ruby
def select(sql, name = nil, binds = [])
exec_query(sql, name, binds)
end
```
---
More details about this commit: the only two DB-specific adapters
that have a different definition of `select` are MySQLAdapter and
MySQL2Adapter.
In MySQLAdapter, `select` invokes `exec_query(sql, name, binds)`, so
calling `super` achieves the same goal with less repetition.
In MySQL2Adapter, `select` invokes `exec_query(sql, name)`, that is,
it does not pass the `binds` parameter like other methods do. However,
[MySQL2Adapter's `exec_query`](https://github.com/rails/rails/blob/74a527cc63ef56f3d0a42cf638299958dc7cb08c/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L228L231)
works exactly the same whether this parameters is passed or not, so the output
does not change:
```ruby
def exec_query(sql, name = 'SQL', binds = [])
result = execute(sql, name)
ActiveRecord::Result.new(result.fields, result.to_a)
end
```
|
|\ \ \
| |/ /
|/| | |
AJ doc fixes [ci skip]
|
| | |
| | |
| | |
| | | |
[ci skip]
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
accepts blocks for `assert_no_enqueued_jobs` and `assert_no_performed_jobs` test helpers.
- args => arguments when used in actual docs.
[ci skip]
|
|\ \
| | |
| | | |
Mention `perform_now` in AJ base docs to specify how to immediately invoke a job [ci skip]
|
| | |
| | |
| | |
| | | |
job. [ci skip]
|
| | | |
|
|\ \ \
| | | |
| | | | |
Enable emitting of warnings from ActiveJob tests.
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Message on AR::UnknownAttributeError should include the class name of a record
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This would be helpful if 2 models have an attribute that has a similar
name to the other. e.g:
before:
User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"])
# => ActiveRecord::UnknownAttributeError: unknown attribute: name
after:
User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"])
# => ActiveRecord::UnknownAttributeError: unknown attribute on User: name
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This would be helpful if 2 models have an attribute that has a similar
name to the other. e.g:
before:
User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"])
# => ActiveRecord::UnknownAttributeError: unknown attribute: name
after:
User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"])
# => ActiveRecord::UnknownAttributeError: unknown attribute on User: name
|
|\ \ \ \ \
| |_|_|/ /
|/| | | | |
|
|/| | | |
| | | | |
| | | | |
| | | | | |
https://github.com/justanshulsharma/rails into justanshulsharma-activerecord-merge-docs
|
| | | | | |
|
| | |/ /
| |/| | |
|
|\ \ \ \
| |/ / /
|/| | | |
remove duplicate method (_status_code) in action_dispatch
|
| | | | |
|