activerecord-hackery / meta_search

Object-based searching (and more) for simply creating search forms. Not currently maintained.
http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/
MIT License
906 stars 140 forks source link

Sort column by extracted value #113

Open archonic opened 11 years ago

archonic commented 11 years ago

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?