Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Saving "last_column" in visit_Arel_Attributes_Attributes may break Arel::Nodes::NamedFunction #153

gama opened this Issue · 0 comments

1 participant


Maybe I'm not "doing it right", but I cound't find any solutions by browsing through the source code or checking
Google... So, here it goes:

When calling a named function such as "CONCAT" with table columns/attributes among the parameters, the type of the column/attribute is used to convert the following attribute. As far as I could understand, this is required to properly convert the type of the right hand side of binary visitors, and is acomplished by saving the "last_column" instance attribute when visiting a Arel::Attribute::Atribute (which is later used by "quote").

However, when supplying a list of values to a named function (or any other arel node which uses "{}" I believe), the evaluation of the nodes sequentially breaks due to this type convertion.

An example always helps, so:

class T < ActiveRecord::Base
ts = T.arel_table'CONCAT', [ts['id'], '#']).to_sql
# "CONCAT(`complaint_records`.`id`, 0)"

Not that the '#' string is converted to 0, because the previous value in the array is an Arel::Attributes::Attribute whose type is "integer".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.