Displaying 2 results from an estimated 2 matches for "old_connection".
Did you mean:
nbd_connection
2005 Dec 30
0
Changing the current connection for Active Record
...ode in my unit tests to run as an admin user. This
way I don''t have to grant unneeded privileges for my application user
just so the unit tests will run. Does anyone understand the connection
handling and how it changed enough to help?
Thanks,
Matt
<snippet>
def self.with
old_connection = ActiveRecord::Base.connection
ActiveRecord::Base.active_connections[ActiveRecord::Base] =
connection
yield
ensure
ActiveRecord::Base.active_connections[ActiveRecord::Base] =
old_connection if old_connection
end
</snippet>
________________________________________...
2006 Jun 26
1
Separate Read and Write Database
Hello,
I need to access an mirrored database with one read and one write
cluster. Is there a way to tell a model to use two connections? So that
all updates etc go to the write database and all read from the read one?
This is a fixed set up I can not use MySQL 5.x stuff and additionally i
get a token on write, which can be checked on read (and wait for
replication) if new data is needed.
I