title: form_for undefined method `model_name' for ::ActiveRecord_Relation:Class
body: <p>I have been having issues with form_for rendering. I want to have a _form.html.erb partial that deals with both the creation and editing of my Problem record. When I go down the route of using </p>
  
  <pre><code>&lt;%= form_for(@problem) do |f| %&gt;
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>undefined method `model_name' for Problem::ActiveRecord_Relation:Class
  </code></pre>
  
  <p>In my routes.rb I have the following:</p>
  
  <pre><code>PW::Application.routes.draw do
  root to: 'problems#index', via: :get
  resources :problems do
  member do
    post 'up_vote'
    post 'down_vote'
   end
  end
  </code></pre>
  
  <p>I also have this my in Problem Controller</p>
  
  <pre><code>class ProblemsController &lt; ApplicationController
   include Concerns::Votes
  
   def new
    @problem = Problem.new
   end
  
   def index
   @problem = Problem.all
   end
  
   def show
   @problem = find_problem
   end
  
   def create
   @problem = current_user.problems.new(problem_params)
   @problem.save
   redirect_to @problem
   end
  
  
  private
  
   def find_problem
   @problem = Problem.find(params[:id])
  end
  
   def problem_params
  params.require(:problem).permit(:name, :description, :url)
  end
  end
  </code></pre>
  
  <p>I can get it to work if I specify the following :</p>
  
  <pre><code>&lt;%= form_for @problem.new, url: {action: "create"} do |f| %&gt;
  </code></pre>
  
  <p>However I feel that this is repeating myself if I then have to make a separate partial just for the edit. I really cant work out why this doesn't want to work. Could it be I am rendering the form on index.html.erb? </p>
  
  <p>Any help or direction would be very much appreciated. </p>