3

I have this function that I need to modified to select from elements table the rows in which the column filters(array type) contain the feature_id param

def get_categories_by_company_and_feature(company_id:,feature_id:)
   DB[:categories]
  .where(company_id: company_id)
  .join(:elements, category_id: :id)
  .order(:category_name, :element_name)
  .select_all(:categories, :elements)
  .select_append(Sequel[:categories][:user_active].as(:category_user_active),
      Sequel[:categories][:id].as(:category_id),
      Sequel[:elements][:id].as(:element_id))
end

I've seen documentation with array_op.contains(:a) and many operators< but I don't know how to combine it with this syntax.

Also, what kind of operators can I apply for a column like Sequel[:categories][:user_active]?

Zoe
  • 27,060
  • 21
  • 118
  • 148
  • You can try asking on the google talk channel, the creator of Sequel is there all the time. https://groups.google.com/g/sequel-talk – Eyeslandic Nov 21 '22 at 13:23

0 Answers0