I have the following scope:
scope :comments, :conditions => [\'text_value IS NOT NULL\']
But I also want the conditions to say \"OR text_val
Personally I am doing like this:
1) Add to initializers
class Arel::Attributes::Attribute
# Encode column name like: `posts`.`author_id`
def to_sql
"`#{relation.table_name}`.`#{name}`"
end
def is_not_empty
"#{to_sql} <> ''"
end
end
2) Add to your model
scope :comments, -> { where(arel_table[:text_value].is_not_empty) }
Good luck!