title: how to get value selected by using select_tag with options_from_collection_for_select and pass it to controller
body: <p>I have built a form search like this:</p>
  
  <pre><code>&lt;%= form_tag({ controller: 'questions', action: 'search_topic' }, method: 'get') do %&gt;
    &lt;%= select_tag 'search_topic', options_from_collection_for_select(current_user.get_topics, :id, :name) %&gt;
    &lt;%= submit_tag "Search", name: nil, class: 'btn' %&gt;
  &lt;% end %&gt; 
  </code></pre>
  
  <p>I want to search all questions of a topic selected from select box, i used sunspot to help for search, so now how can i pass value select from select box to controller for search, i used below code to pass a params[:search]:  </p>
  
  <pre><code>&lt;%= select_tag 'search_topic', options_from_collection_for_select(current_user.get_topics, :id, :name), params[:search] %&gt;
  </code></pre>
  
  <p>but it has error: </p>
  
  <pre><code>undefined method `[]' for nil:NilClass
  </code></pre>
  
  <p>this is my controller:</p>
  
  <pre><code>def search_topic
    @search = Question.search do
      with(:topic_id, params[:search])
      paginate page: 1, per_page: 10
    end
  
    @questions = @search.results
    render 'index'
  end
  </code></pre>
  
  <p>so, how can i pass value selected from select box on form to controller for search?</p>