@@ -126,6 +126,7 @@ public class RubyJdbcConnection extends RubyObject {
126
126
private IRubyObject adapter ; // the AbstractAdapter instance we belong to
127
127
private volatile boolean connected = true ;
128
128
private RubyClass attributeClass ;
129
+ private RubyClass timeZoneClass ;
129
130
130
131
private boolean lazy = false ; // final once set on initialize
131
132
private boolean jndi ; // final once set on initialize
@@ -135,6 +136,7 @@ public class RubyJdbcConnection extends RubyObject {
135
136
protected RubyJdbcConnection (Ruby runtime , RubyClass metaClass ) {
136
137
super (runtime , metaClass );
137
138
attributeClass = runtime .getModule ("ActiveModel" ).getClass ("Attribute" );
139
+ timeZoneClass = runtime .getModule ("ActiveSupport" ).getClass ("TimeWithZone" );
138
140
}
139
141
140
142
private static final ObjectAllocator ALLOCATOR = new ObjectAllocator () {
@@ -2441,6 +2443,9 @@ protected void setStatementParameter(final ThreadContext context,
2441
2443
if (attributeClass .isInstance (attribute )) {
2442
2444
type = jdbcTypeForAttribute (context , attribute );
2443
2445
value = valueForDatabase (context , attribute );
2446
+ } else if (timeZoneClass .isInstance (attribute )) {
2447
+ type = jdbcTypeFor ("timestamp" );
2448
+ value = attribute ;
2444
2449
} else {
2445
2450
type = jdbcTypeForPrimitiveAttribute (context , attribute );
2446
2451
value = attribute ;
0 commit comments