Skip to content

Instantly share code, notes, and snippets.

@warnergodfrey
Created October 20, 2011 23:10
Show Gist options
  • Save warnergodfrey/1302673 to your computer and use it in GitHub Desktop.
Save warnergodfrey/1302673 to your computer and use it in GitHub Desktop.
table = OfferByDate.arel_table
subquery = table.project('*').where(table[:offer_id].eq 1).where(table[:night_of].eq '2011-10-21').as('subquery')
sql = Arel::Table.new('dummy').project('*').from(subquery).to_sql
ActiveRecord::Base.connection.select_all(sql).to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment