09 Jun '12, 11am

ASCIIcast 354 - Squeel

This is translated into an SQL query for us and the products matching the query are returned. Note that there are no spaces around the braces in the query as the convention for the Squeel DSL seems to be not to use them and we’ll stick to that here. The object that’s returned from this call is an ActiveRecord::Relation object and we can use it alongside any other scopes that we use in Rails. Squeel uses more than ActiveRecord::Relation , though. It’s build on Arel and uses that to convert queries into SQL. We can see this if we look at the Squeel README which has a table showing a list of the operators that Arel supports along with the equivalent SQL operator. So, instead of using the < operator that Squeel provides we can use Arel’s lt method directly to make the same query.

Full article: http://railscasts.com/episodes/354-squeel?language=en&vie...

Tweets

Episode 354: Squeel

railscasts.com 30 May '12, 9am

Squeel provides a comprehensive DSL for writing SQL queries in Ruby. It is built upon Arel giving you access to many of it...

@omnidactyl

railscasts.com 02 Jun '12, 5pm

Squeel provides a comprehensive DSL for writing SQL queries in Ruby. It is built upon Arel giving you access to many of it...

SQL Literals in Squeel (or, Overriding Backtick...

rubyflow.com 30 May '12, 3pm

SQL Literals in Squeel (or, Overriding Backticks in Ruby) Posted by ernie on May 30, 2012 — 0 comments I just posted detai...