Q:

Controller, Model, View. Confusion with passing params

I have a simple self method defined in my model.
def self.search(name, type)
  #handle name
  #handle type
end

My confusion is with regards to the view & controller. Passing the correct values (or using the correct syntax).
In the view, a simple form.
<%= form_tag(index_path, method: :get) do %>
  <%= label_tag :type, 'Type' %>
  <% type_array = ["Foo", "Foo_One", "Foo_Two", "Foo_Three"] %>
  <%= select_tag :type, options_for_select(type_array, selected: params[:type]), include_blank: true %>

  <%= label_tag :name, 'Name' %>
  <% name_array = ["Foo", "Foo_One", "Foo_Two", "Foo_Three"] %>
  <%= select_tag :name, options_for_select(name_array, selected: params[:name]), include_blank: true %>

  <%= submit_tag "Filter" %>
<% end %>

Confusion One
Under options_for_select, should it be select_tag :search or select_tag :type? Should it be selected: params[:search] instead??
In the controller
def index
  @foo = Foo.all
  #variation 1 that i tried
  @foo = @foo.search(params[:search]) if search(params[:search]).present?
  #variation 2 that i tried
  @foo = @foo.search(params[:name,:type]) if search(params[:name,:type]).present?
  #variation 3 that i tried
  @foo = @foo.search(params[:name][:type]) if search(params[:name][:type]).present?
end

Confusion Two
Variation 3 kind of makes the most sense to me. But i dont see the self.search getting called. Also it throws an error (no implicit conversion of Symbol into Integer).
I'm not sure if the error is with my forms too?
Clearly i'm not very proficient with knowing where to pass the params and "collect" them. I've tried reading the ruby documentation but had a hard time understanding it. 
I think the bigger picture would be, whats the proper syntax (or way to collect arguments) in a form for a method? 

A:

Confusion 1: It doesn't matter what the select_tags are called in your case as you don't seem to have it tied to an actual model attribute, but 'name' and 'type' are quite confusing simply as there are HTML attributes name and type on input fields. Still, it will still work the way you have done it and the 'selected' options look just fine. 
Confusion 2: You need to access them individually from the params hash: 
@foo.search(params[:name], params[:type]) if params[:name].present? || params[:type].present?

However, you have defined it as a self method as so:
class FooClass
  def self.search(name, type)
    # blah
  end

This means you can't access it on an instance of the class, i.e @foo.search, you would call it from the class itself:
FooClass.search(params[:name], params[:type]) if params[:name].present? || params[:type].present?

If on the other hand you didn't have the 'self', as so:
class FooClass
  def search(name, type)
    # blah
  end

The you could do:
@foo = FooClass.new
@my_var = @foo.search(params[:name], params[:type])

