title: I keep getting this error <undefined method `category_id' for #<ActionController::Parameters>>
body: <p>Im currently trying to create a search form and everytime I try to send a request rails always report me the NoMethodError above. Below is my code.</p>
  <pre><code>controller
      @search_cat = params['search_cat']
      if @search_cat.present?
        category_id = @search_cat['category_id']
        @tasks = Task.where(user_id: current_user.id, category_id: category_id.to_i)
      end
  </code></pre>
  <pre><code>view
  &lt;%= simple_form_for :search_cat, url: tasks_index_path, method: &quot;GET&quot;, html: { class: 'form-inline' } do |f| %&gt;
    &lt;%= f.input :category_id, collection: current_user.categories,as: :select %&gt;
    &lt;%= f.submit &quot;Search&quot;, class: &quot;btn btn-primary&quot; %&gt;
  &lt;% end %&gt;
  
  </code></pre>
  <pre><code>  def tasks_params
      params.require(:task).permit(:deadline_at,:title, :tags, :note, :is_done, :category_id, :user_id, {tag_ids: []})
    end
  </code></pre>
  <p>edit:</p>
  <pre><code>class Task &lt; ApplicationRecord
  
    belongs_to :user, optional: true
    belongs_to :category, optional: true
  
    has_many :tag_associations, dependent: :destroy
    has_many :tags, through: :tag_associations
  
  
  end
  </code></pre>
  <pre><code>schema
  create_table &quot;tasks&quot;, force: :cascade do |t|
      t.datetime &quot;deadline_at&quot;
      t.string &quot;title&quot;
      t.string &quot;note&quot;
      t.boolean &quot;is_done&quot;
      t.integer &quot;user_id&quot;
      t.integer &quot;category_id&quot;
      t.datetime &quot;created_at&quot;, precision: 6, null: false
      t.datetime &quot;updated_at&quot;, precision: 6, null: false
      t.index [&quot;category_id&quot;], name: &quot;index_tasks_on_category_id&quot;
      t.index [&quot;user_id&quot;], name: &quot;index_tasks_on_user_id&quot;
  </code></pre>
  <p>I basiclly just trying send the input from the search form to query controller.</p>
  <p><a href="https://i.stack.imgur.com/YDKNy.png" rel="nofollow noreferrer">enter image description here</a></p>