-
-
Save universal/3917301 to your computer and use it in GitHub Desktop.
ajax delete issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#<%= dom_id(@match) %>').fadeOut(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<tr> | |
<th>Enemy Team</th> | |
<th>Date</th> | |
<th>Shift</th> | |
<th></th> | |
<th></th> | |
</tr> | |
<% @matches.each do |match| %> | |
<%= div_for match do %> | |
<tr> | |
<% if match.team_id == session[:team_id] %> | |
<td><%= match.enemy_team_id %></td> | |
<% else %> | |
<td><%= match.team_id %></td> | |
<% end %> | |
<td><%= match.date %></td> | |
<td><%= match.shift %></td> | |
<td><%= link_to 'Edit', edit_team_match_path(@team, match) %></td> | |
<td><%= link_to 'Destroy', [@team, match], method: :delete, remote: true %></td> | |
</tr> | |
<% end %> | |
<% end %> | |
</table> | |
<%= link_to "New Match", new_team_match_path(@current_team) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy | |
@match = Match.find(params[:id]) | |
@match.destroy | |
# redirect_to team_matches_url, :notice => "Match Deleted" | |
respond_to do |format| | |
format.html { redirect_to team_matches_url, :notice => "Match Deleted" } | |
format.json { head :ok } | |
format.js | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment