I am new in ruby on rails and i am trying to pass id in url from one controller to another controller. And i am getting this error.
Couldn't find Tournament without an ID
And here is my code: matches View
<h2 class="text-center mt-4"><%= @tournaments.id %></h2>
<h2 class="text-center mt-4"><%= @tournaments.title %></h2>
<p>
<% @players = @tournaments.player_ids %>
Players = <%= @players.uniq %>
</p>
<div class="container">
<div class="row justify-content-md-center">
<div class="col-8 mt-4">
<div class="card text-center shadow mb-5 bg-white rounded">
<div class="card-header font-italic">
</div>
<div class="card-body">
<%= link_to "Edit", edit_tournament_path(@tournaments), class: "btn btn-outline-info" %>
<%= link_to "Delete", tournament_path(@tournaments), method: "delete", class: "btn btn-outline-danger", data: {confirm: "Are you sure you want to delete?"} %>
</div>
</div>
</div>
<p><%= link_to "All Tournaments", root_path, class: "btn btn-outline-primary float-right" %></p>
<p><%= link_to "Schedules", matches_path(@touraments), class: "btn btn-outline-primary float-right" %></p>
</div>
This is my another controller where i want this data:
class MatchesController < ApplicationController
def index
@match = Tournament.find(params[:id])
end
end