Module: Sequel::ActiveRecordConnection::Utils

Defined in:
lib/sequel/extensions/activerecord_connection/utils.rb

Class Method Summary collapse

Class Method Details

.add_prepared_statements_cache(conn) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/sequel/extensions/activerecord_connection/utils.rb', line 12

def self.add_prepared_statements_cache(conn)
  return if conn.respond_to?(:prepared_statements)

  class << conn
    attr_accessor :prepared_statements
  end
  conn.prepared_statements = {}
end

.set_value(object, name, new_value) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/sequel/extensions/activerecord_connection/utils.rb', line 4

def self.set_value(object, name, new_value)
  original_value = object.send(name)
  object.send(:"#{name}=", new_value)
  yield
ensure
  object.send(:"#{name}=", original_value)
end