File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
activerecord/lib/active_record
railties/test/application Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ class Railtie < Rails::Railtie # :nodoc:
88
88
89
89
initializer "active_record.postgresql_time_zone_aware_types" do
90
90
ActiveSupport . on_load ( :active_record_postgresqladapter ) do
91
- ActiveRecord ::Base . time_zone_aware_types << :timestamptz
91
+ ActiveSupport . on_load ( :active_record ) do
92
+ ActiveRecord ::Base . time_zone_aware_types << :timestamptz
93
+ end
92
94
end
93
95
end
94
96
Original file line number Diff line number Diff line change @@ -148,5 +148,14 @@ def self.count
148
148
149
149
assert_match "42" , rails ( "runner" , "puts Task.count" )
150
150
end
151
+
152
+ def test_works_with_database_url
153
+ db_name = use_postgresql
154
+ previous_url = ENV [ "DATABASE_URL" ]
155
+ ENV [ "DATABASE_URL" ] = "postgres://localhost/#{ db_name } "
156
+ assert_equal "1" , rails ( "runner" , "print 1" )
157
+ ensure
158
+ ENV [ "DATABASE_URL" ] = previous_url
159
+ end
151
160
end
152
161
end
You can’t perform that action at this time.
0 commit comments