13 Matching Annotations
  1. Mar 2020
    1. between(other)

      It looks like, if for reason you couldn't express the range as a ruby Range, it wouldn't let you pass in an array of two arbitrary values and use that (because it requires other to respond to begin and end), but you could use build your own Between node yourself like:

      Nodes::Between.new(self, left.and(right))

    2. Hard to find documentation that has this list. Source code as docs it is!

  2. Jan 2020
    1. Arel’s ComposabilityInternally Arel functions on AST nodes and every time an Arel method is made, the nodes in the AST will be modified accordingly. This is an important nature of how Arel works — composability, so that it’s able to build queries in a flexible way. With this abstract representation, we are able to safely add different filters and operations to the same query and even combine queries regardless of its order. Arel is able to generate the correct SQL query from it.
    2. Arel’s responsibility is SQL query construction and optimization, and it knows very little about ActiveRecord’s Models and nothing about the database. Arel provides the basic building blocks for ActiveRecord.
    1. You might be thinking––"a tool that allows me to write semantic and reusable queries? Sounds like Active Record". It's absolutley true that Active Record already provides a powerful query tool kit. But what happens when even simple queries stretch the bounds of Active Record's capabilities?
    2. Arel is a SQL AST (Abstract Syntax Tree-like) manager for Ruby. It allows us to write complex SQL queries in a semantic, reusable fashion. Arel is "framework framework"; it's designed to optimize object and collection modeling over database compatibility. For example, Active Record is built on top of Arel.