Rails 3 中有没有办法在不进行字符串或数组合并的情况下有条件地合并记录条件?
例如:
conditions = #?
if !params[:x].blank?
# add a condition
end
if user.role?(:admin)
# add a condition
end
if params[:y]
# add a condition
end
etc
result = Record.where(xx).group(:id).order(some_var)
# xx would merge all then group and order