Maybe try this:
ActiveRecord::Base.establish_connection(...)
ActiveRecord::Base.connection.execute(...)
More Related Contents:
- Rails raw SQL example
- PostgreSQL GROUP BY different from MySQL?
- MySQL not using indexes with WHERE IN clause?
- Best way to count rows by arbitrary time intervals
- Disable Rails SQL logging in console
- ActiveRecord Arel OR condition
- LEFT OUTER JOIN in Rails 4
- Perform this hours of operation query in PostgreSQL
- Join multiple tables with active records
- PostgreSQL where all in array
- SQL where joined set must contain all values but may contain more
- Find records where join doesn’t exist
- Rails 4 LIKE query – ActiveRecord adds quotes
- Find all records which have a count of an association greater than zero
- Rails find record with zero has_many records associated [duplicate]
- Prepared Statement on Postgresql in Rails
- ActiveRecord find_each combined with limit and order
- Select first row in each GROUP BY group?
- Optimal way to concatenate/aggregate strings
- Doing a WHERE .. IN subquery in Doctrine 2
- SQL left join vs multiple tables on FROM line?
- Delete duplicate rows (don’t delete all duplicate)
- Return a value if no record is found
- How do I remove redundant namespace in nested query when using FOR XML PATH
- Alternatives to LIMIT and OFFSET for paging in Oracle [duplicate]
- How can I get the number of days between 2 dates in Oracle 11g? [duplicate]
- Can you have if-then-else logic in SQL? [duplicate]
- Sorting string column containing numbers in SQL?
- IIS connecting to LocalDB
- Fetch records that are non zero after the decimal point in PostgreSQL