title: undefined method `to_model' ActiveRecord Relation
body: <p>I have this exact error message: <code>undefined method to_model' for #&lt;Onduleur::ActiveRecord_Relation:0x007f8bcf631110&gt;</code></p>
  
  <p>I am missing something...but what ?
  Thanks for your help :)</p>
  
  <p>This is a search form in <strong>views/installations/_form.html.erb</strong></p>
  
  <pre><code>&lt;%= simple_form_for :query, url: @onduleurs, method: :get, wrapper: :inline_form, html: {class: 'form-inline'} do |f| %&gt;
    &lt;%= f.input :identifier, collection: Onduleur.group(:identifier).map {|o| o.identifier} ,  prompt: "Choississez un onduleur" %&gt;
    &lt;%= f.button :submit, "Chercher", class:"btn btn-success" %&gt;
    &lt;%= link_to "Voir tous les onduleurs", {controller: "installations", action: 'show'}, class: "btn btn-success"  %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Here is my <strong>installations_controller.rb</strong></p>
  
  <pre><code> class InstallationsController &lt; ApplicationController
  
    def index
      @installations = Installation.all
    end
  
    def show
      filter_onduleurs if params[:query].present?
      @onduleurs ||= Onduleur.all
      @installation = Installation.find(params[:id])
    end
  
    def new
      @installation = Installation.new
    end
  
    def create
      @installation = Installation.new(installation_params)
      if @installation.save
        redirect_to installations_path, notice: "L'installation a bien été crée"
      else
        render :new, notice: "L'installation n'a pas pu être crée, veuillez rééssayer"
      end
    end
  
  
    private
  
    def filter_onduleurs
      @onduleurs = Onduleur.where('identifier LIKE ?', params[:query][:identifier]) if params[:query][:identifier].present?
      @onduleurs = Onduleur.where('datetime LIKE ?', params[:query][:datetime]) if params[:query][:datetime].present?
    end
  
    def installation_params
      params.require(:installation).permit(:name)
    end
  end
  </code></pre>
  
  <p>About my models: </p>
  
  <p><strong>installation.rb</strong></p>
  
  <pre><code>has_many :onduleurs,  dependent: :destroy
  </code></pre>
  
  <p><strong>onduleur.rb</strong></p>
  
  <pre><code>belongs_to :installation
  </code></pre>
  
  <p>Here are my routes:</p>
  
  <pre><code> resources :installations do
    resources :onduleurs do
      collection {post :import}
    end
  end
  root to: "installations#index"
  </code></pre>