Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a subquery in Rails using Active Record
query = select(:author, :created_at)
.from(
where("created_at >= ?", Date.today - 6.months)
.order(created_at: :desc)
.limit(100)
).order(author: :asc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.