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 |
# 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) yield conn end end |
#transaction(opts = OPTS) ⇒ Object
Reject unsupported Postgres-specific transaction options.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sequel/extensions/activerecord_connection/postgres.rb', line 18 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 |