sql - Arel (Rails) Is it possible to make complex query? -
i need create query db using any/all
. after research arel possibilities found out arel doesn't have short commands (like eq
, lt
, gt
etc) has arel::sqlliteral
1 example. me not obviousl how can use classic query this:
select column_name(s) table_name column_name operator (select column_name table_name condition);
instead of query in example. show me how should like?
you may activerecord methods, without usage of arel:
sub_query = model.select(:column_name).where(condition).to_sql model. select("column_name(s)"). where("column_name operator (#{sub_query})")
Comments
Post a Comment