Explaining:
When you call arel_table for an ActiveRecord class, this will return an Arel::Table object.
With Arel::Nodes::Case, you can create an object that generates a CASE expression.
The method outer_join is used to left join a table, that returns an Arel::SelectManager object. Please remember to call the method on with the ON clause.