Search code examples
ruby-on-railsrubyruby-on-rails-3arelmultiple-databases

How to use AREL when using multiple databases?


When invoking Table(*column_symbol*) arel assumes that we are using the main database.

How can I use arel tables in a second database without having to ARModels for each of the queried tables?


Solution

  • table = Arel::Table.new("db_name.table_name")