Module: Sequel::ActiveRecordConnection::Postgres
- Defined in:
- lib/sequel/extensions/activerecord_connection/postgres.rb
Defined Under Namespace
Modules: ConnectionMethods
Instance Method Summary collapse
- #synchronize ⇒ Object
-
#transaction(opts = OPTS) ⇒ Object
Reject unsupported Postgres-specific transaction options.
Instance Method Details
#synchronize ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sequel/extensions/activerecord_connection/postgres.rb', line 6 def synchronize(*) super do |conn| conn.extend(ConnectionMethods) conn.instance_variable_set(:@db, self) Utils.add_prepared_statements_cache(conn) Utils.set_value(conn, :type_map_for_results, PG::TypeMapAllStrings.new) do yield conn end end end |
#transaction(opts = OPTS) ⇒ Object
Reject unsupported Postgres-specific transaction options.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sequel/extensions/activerecord_connection/postgres.rb', line 20 def transaction(opts = OPTS) i[deferrable read_only synchronous].each do |key| fail Error, "#{key.inspect} transaction option is currently not supported" if opts.key?(key) end super rescue => e activerecord_connection.clear_cache! if e.class.name == "ActiveRecord::PreparedStatementCacheExpired" && !in_transaction? raise end |