| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Hash#keys.each allocates an array of keys; Hash#each_key iterates through the
keys without allocating a new array. This is the reason why Hash#each_key
exists.
|
|
|
|
| |
@column_names_with_alias, @dynamic_methods_hash, @time_zone_column_names, and @cached_time_zone
|
|
|
|
| |
- middlware -> middleware
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Benchmark:
```ruby
require 'objspace'
require 'active_record'
ActiveRecord::Base.establish_connection adapter: "sqlite3",
database: ":memory:"
ActiveRecord::Base.connection.instance_eval do
create_table(:articles) { |t| t.string :name }
end
class Article < ActiveRecord::Base; end
a = Article.create name: "foo"
a = Article.find a.id
N = 10
ObjectSpace::AllocationTracer.trace do
N.times { Article.find a.id }
end
ObjectSpace::AllocationTracer.allocated_count_table
table.sort_by { |_,x| x }.each do |k,v|
p k => (v / N)
end
```
|
| |
|
|
|
|
|
|
|
| |
Honoring an overidden `rack.test` allows testing closed connection between
multiple requests. This is useful if you're working on database resiliency, to
ensure the connection is in the expected state from one request to another on
the same worker.
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
| |
it doesn't work on SQLite3 since it doesn't support truncate, but that's
OK. If you call truncate on the connection, you're now bound to that
database (same as if you use hstore or any other db specific feature).
|
|
|
|
|
|
|
| |
Previously the documentation stated that `primary_key` should be the name of
a *method* that returns the primary key used for the association. This is
incorrect. This changes the documentation to say that the value must be the
name of a column.
|
| |
|
|
|
|
| |
:foreign_key option that's a symbol
|
|
|
|
|
| |
This test has always been green because it uses "assert" and the first
argument is an truthy class/object.
|
| |
|
|\
| |
| |
| | |
ActiveRecord CHANGELOG improvements [skip ci]
|
|/ |
|
|
|
|
|
| |
The hash is now string-keyed, and [_]reflect_on_association calls `to_s` on the
argument anyway.
|
|
|
|
|
|
|
|
|
| |
For now, we will just skip the cache when a non-column key is used in the hash.
If the future, we can probably move some of the logic in PredicateBuilder.expand
up the chain to make caching possible for association queries.
Closes #16903
Fixes #16884
|
|
|
|
|
|
| |
This is pretty lame though, so feel free to send a PR with a better fix! ;)
cc @zev @tenderlove
|
|\
| |
| | |
Update RecordNotFound exception cases to include a message with the
|
| |
| |
| |
| | |
Model that the Record was not found in.
|
|\ \
| | |
| | | |
Updated comment about features of fixtures
|
| | |
| | |
| | |
| | |
| | |
| | | |
- Added a note about some features which are not dependent on
auto-generated ID's.
- [ci skip]
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While investigating #16951 I found that another library's monkey-patching of
`Enumerable` was causing the test migrations helper to break when trying to
build the `CREATE DATABASE` statement. The prior approach used `#sum` to build
the string from the options hash.
As the code that combines the options to build the database statement is not
user-facing, using `#inject` here instead will remove the only place where the
database creation/migration code is dependent on ActiveSupport's monkey-patching
of `Enumerable`.
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Don't autosave unchanged has_one through records
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
|
|\ \ \
| | | |
| | | | |
Allow YAML serialization when using TZ aware attributes
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | |
| | | |
| | | | |
kongregate/fix-activerecord-deprecated_finders-find-symbol
ActiveRecord deprecated finders are broken in 4.2
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
Maintain compatibility for:
* ActiveRecord::Base#find(:all)
* ActiveRecord::Base#find(:first)
* ActiveRecord::Base#find(:last)
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| |
| | |
Closes #16907.
[Matthew Draper & Yves Senn]
|
|\ \
| | |
| | |
| | | |
Data corruption risk: Roll back open transactions when the running thread is killed.
|
| | | |
|
|\ \ \
| | | |
| | | | |
Improved the error messaging for the DangerousAttributeError exception
|
| | | |
| | | |
| | | |
| | | | |
that the conflict could be because of a conflicting attribute.
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Working with two different machines is hard :sweat:
|
|/ / /
| | |
| | |
| | |
| | |
| | | |
[Matthew Draper & Yves Senn]
Closes #16860. (pull request to discuss the implementation)
|
|\ \ \
| | | |
| | | |
| | | | |
Default to sorting user's test cases for now
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Goals:
1. Default to :random for newly generated applications
2. Default to :sorted for existing applications with a warning
3. Only show the warning once
4. Only show the warning if the app actually uses AS::TestCase
Fixes #16769
|
| | | |
| | | |
| | | |
| | | | |
Dump the standard schema once instead of redoing it per test
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Allows :limit defaults to be changed without pulling the rug out from
under old migrations that omitted :limit because it matched the default
at the time.
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Updating Associations::Preloader docs
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Much of the previous documentation introduced features new in 2011. This
commit refreshes it to provide clearer code examples and spends more
time describing the normal case (preloaded associations) and less time
describing the fallback.
[ci skip]
|