| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
[ci skip]
|
| |
|
|
|
|
|
|
|
| |
- When the named timestamp column is nil, we should just return the
cache_key with model name and id similar to the behavior of implicit
timestamp columns.
- Fixed one of the issue mentioned in https://github.com/rails/rails/issues/26417.
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The documentation states that parameter values longer than 20 characters
will be truncated by words, but the example shows that a parameter based
on "David Heinemeier Hansson" (with id: 125) becomes "125-david" when
"David Heinemeier".length == 16 so why so short?
The answer lies in the use of the #truncate option omission: nil which
seems to have been intended to mean "nothing", but which actually causes
the default string "..." to be used. This causes #truncate to cleave
words until the "..." can be added and still remain within the requested
size of 20 characters.
The better option is omission: '' (which is probably what was originally
intended).
Furthermore, since the use of #parameterize will remove non-alphanumeric
characters, we can maximize the useful content of the output by calling
parameterize first and then giving truncate a separator: /-/ rather than
a space.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default timestamp used for AR is `updated_at` in nanoseconds! (:nsec) This causes issues on any machine that runs an OS that supports nanoseconds timestamps, i.e. not-OS X, where the cache_key of the record persisted in the database (milliseconds precision) is out-of-sync with the cache_key in the ruby VM.
This commit adds:
A test that shows the issue, it can be found in the separate file `cache_key_test.rb`, because
- model couldn't be defined inline
- transactional testing needed to be turned off to get it to pass the MySQL tests
This seemed cleaner than putting it in an existing testcase file.
It adds :usec as a dateformat that calculates datetime in microseconds
It sets precision of cache_key to :usec instead of :nsec, as no db supports nsec precision on timestamps
|
|
|
|
|
| |
There were a few places where I missed a `create` vs `new`
before_type_cast check, and the semantics of `reload` became wrong.
|
|
|
|
|
|
| |
When I originally reviewed the #20317, I believe these changes were
present, but it appears that it was later updated so that they were
removed. Since Travis hadn't re-run the build, this slipped through.
|
|
|
|
| |
onwards.
|
|
|
|
|
| |
`Computer` class needs to be require
See #17217 for more details
|
|
|
|
|
| |
Ensure the child can actually be touched. The `Bulb` model has no
timestamp column, thus trying to touch it would return `nil`.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* Fix incorrectly named tests
* Restore Object#to_param behavior
* Ensure param is derived from a squished and truncated string
|
|
|
|
| |
attribute or method.
|
| |
|
|
|
|
| |
attributes of which the highest will be used.
|
| |
|
| |
|
|
|
|
|
|
|
| |
According to the doc of `AR::Base#to_param`(
https://github.com/rails/rails/blob/04cda1848cb847c2bdad0bfc12160dc8d554
7775/activerecord/lib/active_record/integration.rb#L18 ), it returns
`nil` if the record is not persisted.
|
|
`AR::Base#to_param` and `AR::Base#cache_key` is defined at
active_record/integration.rb, so tests for those methods should be at
integration_test.rb
|