UPD: Thought that I faced the same issue so I sent a PR. Turns out that I wasn't having the issue. See "details" for the original message
That was an original message. Retaining it for the history
This issue introduces a pretty severe bug when dealing with Rails fixtures. I'm glad it only took me ≈1hr to figure out.~~
How to reproduce:
1. Have a Rails model with an attribute, like: `attribute :time_of_day, :time_only`
2. Have a Rails fixture with `time_of_day: "12:00"`
3. Run the test which loads the fixture
4. Open `bin/rails dbconsole RAILS_ENV=test`
5. Run `select * from `
6. You'll see that the value is 43200 instead of 12:00
The value isn't random:
```
irb(main):001:0> Tod::TimeOfDay.new(12).to_i
=> 43200
```
That messed up my tests _real bad_
~~Ran a simple test to see if the issue is related to the `to_fs` deprecation. It does. Here's what I added to make the tests pass:~~
```ruby
module Tod
class TimeOfDay
alias to_fs to_s
end
end
```
UPD: as it turns out, YAML treats `12:00` as seconds of day. Replace it with `time_of_day: !!str 12:00`
Rails 7 deprecates
to_s
, soIt would be nice to alias
to_formatted_s
toto_fs
to maintain consistency.