May 9, 2015 by Daniel P. Clark

Chaining an Array into Arel ors

I’d like to keep this post short.  So the basic idea behind this is that Arel helps you build SQL queries.  When you want to join multiple queries together into one result you use Arel’s or method.  The way Arel chains additional query commands is by nesting inside the current query.  For example, if you…

Continue Reading »

March 31, 2015 by Daniel P. Clark

Rails 4’s Awesome enums

In Rails 4 enum was introduced to support a feature that people were building by hand or by gem.  What enum does for you is it associates a symbol list for you to reference which will be stored in the database as an integer.  So :cow could be 0 and :dog could be 1 in…

Continue Reading »