title: Ruby on Rails - why i am facing possible unmatched constraints[:exercise_id]
body: <pre><code>def edit    
    @exercise = Exercise.find(params[:exercise_id])      
    @play = @exercise.plays.find(params[:id])    
  end
  
  def update    
    @exercise = Exercise.find(params[:exercise_id])
    @play = @exercise.plays.find(params[:id])    
    if @exercise.plays.update_attributes(play_params)       
      redirect_to @exercise_path      
    else    
      render action: :edit    
    end
  end
  </code></pre>
  
  <p>partial view that is being rendered to show all created plays has</p>
  
  <pre><code>&lt;p&gt;&lt;%= play.name %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= play.sets %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= play.reps %&gt;&lt;/p&gt;
  &lt;%= link_to "edit", edit_exercise_play_path( @exercise, play) %&gt;
  </code></pre>
  
  <p>that is plays_controller :edit, :update method, Actually i have two classes, one is <code>ExerciseController</code> and other one is <code>PlaysController</code>, <code>ExerciseController</code> <code>has_many</code> plays, i am rendering two partials one to create play and other one to show that play on same page on the partial which is rendering the play after creation, but now i want to add edit feature with edit_exercise_play_path,</p>
  
  <pre><code>&lt;%= link_to "Edit", edit_exercise_play_path(@play) %&gt;
  </code></pre>
  
  <p>after this i am facing unmatched constraint error.Thanks</p>
  
  <pre><code>resources :exercises do
  resources :plays
  end
  </code></pre>
  
  <p>Show.html.erb from ExercisesController</p>
  
  <pre><code>&lt;h2&gt;Your Workout Details &lt;/h2&gt;
  &lt;p&gt;&lt;%= @exercise.workout  %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= @exercise.mode %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= @exercise.date.strftime("on %A at %H:%M Dated as %d %B") %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= @exercise.length %&gt;&lt;/p&gt;&lt;br /&gt;
  &lt;h3&gt; Games you Played &lt;/h3&gt;
  &lt;%= render @exercise.plays %&gt;
  &lt;h3&gt;Add new Game &lt;/h3&gt;
  &lt;%= render 'plays/form' %&gt;
  &lt;%= link_to "Edit", edit_exercise_path %&gt; |  |
  &lt;%= link_to "Destroy", exercise_path(@exercise), :confirm =&gt; "Are you 
  sure?", :method =&gt; :delete %&gt; | |
  &lt;%= link_to "Back", root_path %&gt;
  </code></pre>
  
  <blockquote>
    <p>" Logs "
    Started GET "/exercises/5" for 127.0.0.1 at 2018-09-25 18:12:21 +0500
    Processing by ExercisesController#show as HTML
      Parameters: {"id"=>"5"}
      Exercise Load (0.0ms)  SELECT  "exercises".* FROM "exercises" WHERE "exercises"."id" = ? LIMIT ?  [["id", 5], ["LIMIT", 1]]
      Rendering exercises/show.html.erb
      Play Load (0.0ms)  SELECT "plays".* FROM "plays" WHERE "plays"."exercise_id" = ?  [["exercise_id", 5]]
      Rendered collection of plays/_play.html.erb [6 times] (14.0ms)
      Rendered exercises/show.html.erb (39.7ms)
    Completed 500 Internal Server Error in 136ms (ActiveRecord: 0.0ms)</p>
  </blockquote>