app/views/teams/_form.html.erb
<%= form_for(team) do |f| %>
<% if team.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(team.errors.count, "error") %>
prohibitied this team from being saved:</h2>
<ul>
<% team.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :game_day %><br />
<%= f.text_field :game_day %>
</p>
<p>
<%= f.label :game_time %><br />
<%= f.text_field :game_time %>
</p>
<p>
<%= f.label :seasons %>
<%=
select_tag(
'seasons',
options_from_collection_for_select(
Season.all,
'id',
'description',
@team.seasons.map{ |j| j.id }
),
multiple: true
)
%>
</p>
<%= f.submit %>
<% end %>