Skip to content

Commit

Permalink
Merge pull request rails#54353 from Edouard-chin/ec-fix-column
Browse files Browse the repository at this point in the history
Fix column_definition returning a wrong column:
  • Loading branch information
byroot authored Jan 27, 2025
2 parents 59a42a9 + c1ff85f commit bcebc09
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions activerecord/lib/active_record/type/internal/timezone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ def is_utc?
def default_timezone
@timezone || ActiveRecord.default_timezone
end

def ==(other)
super(other) && timezone == other.timezone
end

protected
attr_reader :timezone
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions activerecord/test/cases/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1982,4 +1982,12 @@ def test_protected_environments_are_stored_as_an_array_of_string
assert_not ActiveRecord::Base.current_preventing_writes
end
end

private
def with_timezone_config(cfg, &block)
super(cfg) do
Default.reset_column_information
block.call
end
end
end

0 comments on commit bcebc09

Please sign in to comment.