[typo] connecting to multiple databases and assocations and typo

hemant kumar inxs.hemant at gmail.com
Tue Oct 10 03:58:44 EDT 2006

Ok looks like, I am trying to do joins across databases and that's creating
So, I have removed :user from :include and the Typo works as usual...so I
hope no problems.


-----Original Message-----
From: hemant kumar [mailto:inxs.hemant at gmail.com] 
Sent: Tuesday, October 10, 2006 12:52 PM
To: 'typo-list at rubyforge.org'
Subject: connecting to multiple databases and assocations and typo

hi Scott,

I am trying to integrate Typo with one of existing apps, and hence users
table of typo I want to use from my existing app's database.

So in typo:

class User < ActiveRecord::Base
 establish_connection :users
 # normal typo kung-fu

Then there is a line in controller code, that is creating problems:

    @articles = Article.find( :all,
       :offset => @pages.current.offset,
       :limit => @pages.items_per_page,
       :order => "contents.published_at DESC",
       :include => [:categories, :tags, :user, :blog], #problem line
       :conditions =>
          ['published = ? AND contents.published_at < ? AND blog_id = ?',
           true, Time.now, this_blog.id]

The above line generates Mysql::Error saying users.country column is not
found, though I know very well that, the column is there.

So..if i remove the associations line (the line with :include), then
everything works perfectly. So i think, when i use Associations, its not
connecting to the other database for users table, it still connects to the
existing one and hence not able to find country column there.

Is it a bug in rails?
What are my options?

PS: Ignore it, if you have replied to this mail on rubyonrails mailing list.

Our shadows taller than our Soul 

More information about the Typo-list mailing list