Just saw this PR which honestly makes me ಠ_ಠ
That would be a solved problem already if Arel was a public interface
Two things I’ve already done in multiple codebases:
class ApplicationRecord < ActiveRecord::Base
def self.[](column)
arel_table[column]
end
end
module Arel
module Predications
alias_method :>, :gt
alias_method :<, :lt
alias_method :>=, :gteq
alias_method :<=, :lteq
alias_method :"!=", :not_eq
alias_method :==, :eq
end
end
where(Post[:created_at] <= 30.days.ago)
This solves the same problem as the above PR without introducing anything new to the framework, and it’s much more flexible than the symbol-parsing because you can use it in additional contexts, like
select([Post[:author].as("author_name")])