Hi,
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
end
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?
--
There was only one Road; that it was like a great river: its springs
were at every doorstep, and every path was its tributary.
--~--~---------~--~----~------------~-------~--~----~
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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2006-Oct-10 07:34 UTC
Re: connecting to multiple databases and assocations and typo
On 10/10/06, hemant <gethemant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > end > > 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?You''re trying to join across databases which won''t work. Remove the user include. jeremy --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
hemant
2006-Oct-10 07:51 UTC
Re: connecting to multiple databases and assocations and typo
On 10/10/06, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> You''re trying to join across databases which won''t work. Remove the user > include. > > jeremyYes...thanks for answering this question here also. gnufied -- There was only one Road; that it was like a great river: its springs were at every doorstep, and every path was its tributary. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---