Q:

Can you turn an Arel table back into a scope?

I need Arel to do a few things that aren't possible with ActiveRecord, but my method should return a scope, since callers may want to add a few scopes of their own.
Is this possible?
e.g. User.arel_table.scoped.first

A:

you can use arel statements in Relation#where 
example :
Model.where( Model.arel_table[:column].not_eq( nil )
               .or(Model.arel_table[:other_column].gt( 0 )) )

there's a good ASCIIcast about it (arel is at the end). Additionally, you may be interested by squeel.

