Two ActiveRecords OK?

I have a question regarding the compatbility of Rails and generic
ActiveRecord.

I am running Rails 2.0.2 on a Linux box. My ruby version is 1.8.6.

I need to read from/write to some tables in the same rails production
databases FROM OUTSIDE OF RAILS ENVIRONMENT. According to the
following article, there are at least three ways to do this is Ruby:

  1. Database driver; 2. DBI; 3. ActiveRecord.

Of course the 3rd method (using the ActiveRecord) seems the most
natural one given the grammar is the same as in Rails. My question is
as follows.

As we know, ActiveRecord is part of Rails. If I use the 3rd method to
access the database, will that actually cause any problems to Rails,
because I am using the same ActiveRecord in two places?

Thanks!

On 2/19/08, newbie [email protected] wrote:

As we know, ActiveRecord is part of Rails. If I use the 3rd method to
access the database, will that actually cause any problems to Rails,
because I am using the same ActiveRecord in two places?

No.


Greg D.
http://destiney.com/

No, it won’t cause any problems. Rails is really a gem (hence the
common gem install rails --include-dependencies) and ARec is just one
of its gem dependencies. Since it’s on your system as a gem you can
use it in any Ruby project. You won’t have the framework to issue the
correct top-level include, but I’m sure you’ll get that worked out!

Got it! Thanks a lot!