Skip to content

Commit

Permalink
Replace to_formatted_s with to_s to convert date to string (#8105)
Browse files Browse the repository at this point in the history
replace to_formatted_s with to_s to convert date to string

Solves the following deprecation warning in Rails 7.1:
```
DEPRECATION WARNING: to_default_s is deprecated and will be removed from Rails 7.2 (use to_s instead)
```

Check deprecation
[here](https://github.com/rails/rails/blob/v7.1.1/activesupport/lib/active_support/core_ext/date/conversions.rb#L59)

It shouldn't be a problem in [Rails 6.1](https://github.com/rails/rails/blob/v6.1.7.6/activesupport/lib/active_support/core_ext/date/conversions.rb#L59
) or [Rails 7.0](https://github.com/rails/rails/blob/v7.0.8/activesupport/lib/active_support/core_ext/date/conversions.rb#L59
)
  • Loading branch information
mgrunberg committed Oct 13, 2023
1 parent bb57a26 commit 6486bb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_admin/resource_controller/streaming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def stream_resource(&block)
end

def csv_filename
"#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_formatted_s(:default)}.csv"
"#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_s}.csv"
end

def stream_csv
Expand Down

0 comments on commit 6486bb8

Please sign in to comment.