I am trying to connect to an external database from my Rails application. In my datanase.yml file, I have the following: external_db: adapter: mysql2 database: external_src username: external_src password: mypassword host: myblog.com The database is going to called to retrieve data for display in one of the pages. I do have a pages controller, but I do not have a pages model, so I created a pages mode, pages.rb and added the following to it: class Blog < ActiveRecord::Base establish_connection(:external_db) set_table_name :posts end Now, in my pages controller, how do I retrieve data? Let''s say I have a table in that database called pots and I would like to retrieve the post with the id 2? I tried: Blog.find(2), but I am getting the following error message: uninitialized constant PagesController::Blog Any ideas? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.