title: to make .ransack(params[:q]) operate on the array
body: <p>Question model has_many Answers. Lines below count how many answers question has and order them according to the amount of answers in DESC order. So, most answered questions first.</p>
  
  <pre><code>@search = Question.find(:all,
                            joins: :answers,
                            select: ' "questions".*, count("answers".id) as answers_count', 
                            group: '"questions".id',
                            order: "answers_count DESC").ransack(params[:q])
  
  @questions = @search.result
  </code></pre>
  
  <p>I also use ransack gem. For ransack to make search I need to add .ransack(params[:q]) to the @search array and call result method on this array. I though this could work, however it doesn't.</p>
  
  <p>What could I use for ransack to start searching? </p>