On Wed, May 19, 2010 at 1:50 PM, Kim <kim.gri...@gmail.com> 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. If an abstract class is
> not the way, what is? If not find_by_sql then is connection.execute
> the right way? Looking for an actual solution.

I think you've got two things mixed up here.

1) the establish connection is what causes a model to connect to a
specific database, effectively overriding the standard connection
setup in ActiveRecord::Base.

2) If you want to have multiple models/tables connected to the same
database, the way to do that is to have an abstract class from which
they inherit the connection (much like normal models inherit the
connection from ActiveRecord::Base).

So if you only have a single model/table in the database, then just
use 1 and not 2, I think.

HTH


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to