Permalink
Browse files

Compare driver class, not the object itself.

  • Loading branch information...
1 parent 416655d commit d1a96f9f3e744f243e22147a388894c5bd265644 @Pistos committed Jul 14, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/m4dbi/model.rb
View
4 lib/m4dbi/model.rb
@@ -416,7 +416,7 @@ def self.Model( table, options = Hash.new )
end
end
- if defined?( RDBI::Driver::PostgreSQL ) && RDBI::Driver::PostgreSQL == h.driver
+ if defined?( RDBI::Driver::PostgreSQL ) && RDBI::Driver::PostgreSQL === h.driver
# TODO: This is broken for non-SERIAL or multi-column primary keys
meta_def( "last_record".to_sym ) do |dbh_|
self.s1 "SELECT * FROM #{table} WHERE #{pk_str} = currval( '#{table}_#{pk_str}_seq' );"
@@ -426,7 +426,7 @@ def self.Model( table, options = Hash.new )
# meta_def( "last_record".to_sym ) do |dbh_|
# self.s1 "SELECT * FROM #{table} WHERE #{pk_str} = LAST_INSERT_ID();"
# end
- elsif defined?( RDBI::Driver::SQLite3 ) && RDBI::Driver::SQLite3 == h.driver
+ elsif defined?( RDBI::Driver::SQLite3 ) && RDBI::Driver::SQLite3 === h.driver
meta_def( "last_record".to_sym ) do |dbh_|
self.s1 "SELECT * FROM #{table} WHERE #{pk_str} = last_insert_rowid();"
end

0 comments on commit d1a96f9

Please sign in to comment.