Mysql

I am looking for a way to access a database without active record.
Basically when i call a certain action, I want to delete a customer from
the database linked via active record, and insert that customer into
another database on the same server but not linked to this RoRapp.

Suggestions?

I am looking for a way to access a database without active record.
Basically when i call a certain action, I want to delete a customer from
the database linked via active record, and insert that customer into
another database on the same server but not linked to this RoRapp.

you can still use AR even through multiple connections. Each AR model
can have a different database connection. By default they will use the
connection associated to the current environment, but you can just do

class MyModel< ActiveRecord::Base
| establish_connection :differentdb
end
|
And your “MyModel” objects will use the :differentdb connection, which
will be the entry in your database.yml file under the name differentdb:

If you are going to use many models with a sepparate connection you can
even make an “abstract” AR class with only that line for establishing
the connection and then have your models extend from this one.

Of course you can still use Ruby DBI and make all the process manually,
but in that case you have to take care of managing the connection and
with AR you can just forget about low level and concentrate on business
logic.

regards,

javier ramirez

Estamos de estreno… si necesitas llevar el control de tus gastos
visita http://www.gastosgem.com !!Es gratis!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs