I seem to have gotten things to a point in my rails app making sure that games and tickets are being created, but when I try and display them in the html.erb file, the whole database is being rendered...all I'm looking to display is the actual tickets attributes. Here is what it looks like and the code associated with it. Any help is appreciated.
The code is:
<h1> game id is <%= @g.id %> </h1>
<h2> Ticket values are: </h2>
<table>
<%= @g.tickets.each do |tick| %>
<tr>
<td><%= tick.id %></td>
<% if tick.nickname.blank? %>
<td> Available</td>
<% else %>
<td><%= tick.nickname %></td>
<% end %>
<td><%= tick.game_id %></td>
</tr>
<% end %>
</table>
I need to remove the full database portion that is printed out under ticket values, but cant' seem to have it removed without removing everything. Thanks for your help.
The tickets controller is:
class TicketsController < ApplicationController
def create
@ticket = Ticket.new
@ticket.nickname = params["nickname"]
@ticket.game_id = params["game_id"]
@ticket.save
end
end
The games controller is:
class GamesController < ApplicationController
def create
@g = Game.new
@g.winning_ticket_num = params["winning_ticket_num"]
@g.value_per_ticket = params["value_per_ticket"]
@g.save
10.times do
@g.tickets.create
end
render 'games/show'
end
def new
end
def show
end
end