Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Rails 7 deprecation with default_timezone #752

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/activerecord-import/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,12 @@ def add_special_rails_stamps( column_names, array_of_attributes, options )
end

# use tz as set in ActiveRecord::Base
timestamp = ActiveRecord::Base.default_timezone == :utc ? Time.now.utc : Time.now
default_timezone = if ActiveRecord.respond_to?(:default_timezone)
ActiveRecord.default_timezone
else
ActiveRecord::Base.default_timezone
end
timestamp = default_timezone == :utc ? Time.now.utc : Time.now

[:create, :update].each do |action|
timestamp_columns[action].each do |column|
Expand Down