Top "Arel" questions

Arel is a Relational Algebra for Ruby.

Arel, Joins and Rails Queries

I've been stuck on a problem recently for a little while and found my way to Arel which looks like …

ruby-on-rails-3 join arel
using scope on an association

So I got this crazy idea that I wanted to apply a scope to an included association. This is what …

ruby-on-rails-3 activerecord arel
Nested queries in Arel

I am attempting to nest SELECT queries in Arel and/or Active Record in Rails 3 to generate the following SQL …

ruby-on-rails arel
How can you do a conditional where clause using AREL

How can you do a conditional where clause? I have a rake task that runs a query. Say I am …

ruby-on-rails ruby ruby-on-rails-3 arel
SQL "IN subquery" when subquery can be NULL

I have a query that needs to return results that are NOT matched in a sub query. The sub query …

sql ruby-on-rails sqlite postgresql arel
Rails ActiveRecord::StatementInvalid: PG::Error: ERROR: missing FROM-clause entry for table

I've a complex ActiveRecord query that I'm building up with different scopes, depending on the user selection. I'm using 2 gems, …

ruby-on-rails ruby activerecord arel squeel
Deconstructing Rails .joins & .where methods

I have two models - Banner and BannerType. Their schema looks like this: Banner # Table name: banners # # id :integer not …

ruby-on-rails ruby-on-rails-3 arel
How to fetch distinct values with arel/relational algebra

I'm doing my best to bend my brain around arel and the relational algebra behind it, but how to represent …

distinct relational-algebra arel
Ransack: How to use existing scope?

Converting a Rails 2 application to Rails 3, I have to replace the gem searchlogic. Now, using Rails 3.2.8 with the gem Ransack …

ruby-on-rails ruby-on-rails-3 arel ransack
How to override :order defined in a has_many

I have class Authors has_many :books, :order => 'name ASC' I am trying to query all the books sorted …

ruby-on-rails activerecord arel