Patch #41954 » 0005-Override-Psych-yaml-format_time-method.patch
lib/tasks/extract_fixtures.rake | ||
---|---|---|
18 | 18 |
desc 'Create YAML test fixtures from data in an existing database. |
19 | 19 |
Defaults to development database. Set RAILS_ENV to override.' |
20 | 20 | |
21 |
module Psych |
|
22 |
module Visitors |
|
23 |
class YAMLTree |
|
24 |
# Override default time format |
|
25 |
# https://github.com/ruby/ruby/blob/v3_3_6/ext/psych/lib/psych/visitors/yaml_tree.rb#L484-L490 |
|
26 |
def format_time time, utc = time.utc? |
|
27 |
if utc |
|
28 |
time.strftime("%Y-%m-%d %H:%M:%S") |
|
29 |
else |
|
30 |
time.strftime("%Y-%m-%d %H:%M:%S %:z") |
|
31 |
end |
|
32 |
end |
|
33 |
end |
|
34 |
end |
|
35 |
end |
|
36 | ||
21 | 37 |
task :extract_fixtures => :environment do |
22 | 38 |
dir = ENV['DIR'] || './tmp/fixtures' |
23 | 39 |
time_offset = ENV['TIME_OFFSET'] || '' |