Ransack sort with field and with virtual attribute

927 views Asked by At

I am new to Rails, and I am learning to bare with it.

I have a user model

has_many :branches, :dependent => :destroy has_many :comments, :dependent => :destroy

and it has a field profile_type

on the view I am doing this

  <%= search_form_for @search , url: news_path do |f| %>

    <%= f.select :profile_type_eq, [['Doctors', 1], ['Professors', 0], ['Teachers', 2]],
                 include_blank: "All Account Types" %>
    <%= f.submit 'Filter Accounts'%>

<% end %>

I need to be able to add another drop down and another button to filter example profile type doctors with most comments or with most branches. How can I do that with ransack?

1

There are 1 answers

0
ademg On BEST ANSWER

I think it is not possible at all, like it is not possible to search through has_one associations