[Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Kim
Thanks Jonathan for the example. I had been using an AR model for my non-rails table. The piece I was missing was setting the table name! So for others this is what I did class Whatever < AR self.establish_connection :whatever (non-rails DB defined in .yml) self.set_table 'name of non-rails table

[Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Jonathan Rochkind
Jonathan Rochkind wrote: > An AR model for a particular table, as you can see you can even use AR > associations (to other tables within the same db! Trying to make > associations cross-db tends not to work): > http://umlaut.rubyforge.org/svn/trunk/app/models/sfx_db/object.rb Heh, I also see re

[Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Jonathan Rochkind
Kim wrote: > To clarify: > Some of the data for my rails app is stored in a non-rails DB table. I > need to query this other database and then show the data in the rails > app. I can only tell you what I did when I needed to do this. I did NOT use find_by _sql, I actually set up ActiveRecord clas

[Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Kim
To clarify: Some of the data for my rails app is stored in a non-rails DB table. I need to query this other database and then show the data in the rails app. I have a model (have tried with abstract class and without) Computers that is connected to the non-rails DB with establish_connection. Then

Re: [Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Rick DeNatale
On Wed, May 19, 2010 at 1:50 PM, Kim wrote: > Well like I said, I am trying to figure out how to use an abstract > class to access a separate database. I understand why calling the > object attribute is not working, what I am looking for is the proper > way to interact with the separate database.

[Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Kim
Well like I said, I am trying to figure out how to use an abstract class to access a separate database. I understand why calling the object attribute is not working, what I am looking for is the proper way to interact with the separate database. If an abstract class is not the way, what is? If not

[Rails] Re: Multiple Databases using an abstract class - help

2010-05-18 Thread Frederick Cheung
On May 18, 8:39 pm, Kim wrote: >  I am trying to figure out how to use an abstract class to access > multiple databases. I can connect just fine using > establish_connections in an abstract class, and I can query the > database using find_by_sql on the abstract class. I am having problems > with