1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

9 commits

Author SHA1 Message Date
Rafael Mendonça França
c2e12e0191
Use to_formatted_s(:db) instead of to_s(:db) internally
Ruby 3.1 introduced an optimization to string interpolation for some
core classes in b08dacfea3.

But since we override `to_s` in some of those core classes to add behavior
like `to_s(:db)`, all Rails applications will not be able to take advantage
of that improvement.

Since we can use the `to_formatted_s` alias for the Rails specific behavior
it is best for us to deprecate the `to_s` core extension and allow Rails
applications to get the proformace improvement.

This commit starts removing all the `to_s(:db)` calls inside the framework
so we can deprecate the core extension in the next commit.
2021-12-06 19:22:04 +00:00
Prathamesh Sonpatki
8da936a5d3 Fix lookup of fixtures with non-string label
- Fixtures with non-string labels such as integers should be accessed
   using integer label as key. For eg. pirates(1) or pirates(42).
 - But this results in NotFound error because the label is converted into string before
   looking up into the fixtures hash.
 - After this commit, the label is converted into string only if its a
   symbol.
 - This issue was fount out while adding a test case for
   https://github.com/rails/rails/commit/7b910917.
2015-01-06 17:15:39 +05:30
Eric Steele
f47421f2a0 Extend fixture label replacement to allow string interpolation
Allows fixtures to use their $LABEL as part of a string instead
of limiting use to the entire value.

    mark:
      first_name: $LABEL
      username: $LABEL1973
      email: $LABEL@$LABELmail.com

    users(:mark).first_name # => mark
    users(:mark).username   # => mark1973
    users(:mark).email      # => mark@markmail.com
2014-03-15 22:11:36 -04:00
Jon Leighton
f000d4e5fa Quote these dates to prevent intermittent test failure. Suppose local time is 00:50 GMT+1. Without the quoting, the YAML parser would parse this as 00:50 UTC, into the local time of 01:50 GMT+1. Then, it would get written into the database in local time as 01:50. When it came back out the UTC date from the database and the UTC date of two weeks ago would be compared. The former would be 23:50, and the latter would be 00:50, so the two dates would differ, causing the assertion to fail. Quoting it prevents the YAML parser from getting involved. 2011-08-04 00:38:27 +01:00
Aaron Patterson
d8736b266b Revert "this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still."
This reverts commit f92cefa95f.
2011-07-20 15:37:52 -07:00
Josh Kalderimis
f92cefa95f this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still. 2011-07-20 01:00:35 +02:00
Jon Leighton
ac97e25235 Revert "Fix failure in test_preserves_existing_fixture_data from test/cases/fixtures_test.rb when UTC and local time occur on different dates." I am pretty sure this was an incorrect fix, and it still failed in certain circumstances anyway. I am now unable to reproduce the original failure I was experiencing so will leave it for now and see if this pops up again.
This reverts commit e4479b2f1b.
2011-07-17 19:55:05 +01:00
Jon Leighton
e4479b2f1b Fix failure in test_preserves_existing_fixture_data from test/cases/fixtures_test.rb when UTC and local time occur on different dates. 2011-07-12 00:14:45 +01:00
Jeremy Kemper
49eafd8c36 Foxy fixtures. Adapter#disable_referential_integrity. Closes #9981.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8036 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-26 05:56:46 +00:00