activerecord-hackery/meta_search

Sort column by extracted value

archonic opened this issue · 0 comments

I have a model "document" which users have different roles on. This role is extracted and shown in the search results table like so:

<% user_role = '---'
   user_role = 'Member' if (standard.user_ids.include? @current_user.id)
   user_role = 'Leader' if (standard.lead == @current_user)
   %>

<%= user_role %>

Is it possible to sort by the outcome of this logic instead of by something in the document model?