I am new with RoR. I am following a tutorial a the method destoy is not working. If wuould be nice if someone could give an idea whats happening?
Windows 7.
chancellors_controller
# DELETE /chancellors/1
# DELETE /chancellors/1.json
def destroy
@chancellor.destroy
respond_to do |format|
format.html { redirect_to chancellors_url, notice: 'Chancellor was successfully destroyed.' }
format.json { head :no_content }
end
end
index.html.erb
<tbody>
<% @chancellors.each do |chancellor| %>
<tr>
<td><%= chancellor.first_name %></td>
<td><%= chancellor.last_name %></td>
<td><%= chancellor.birthday %></td>
<td><%= chancellor.day_of_death %></td>
<td><%= chancellor.inauguration %></td>
<td><%= link_to 'Show', chancellor %></td>
<td><%= link_to 'Edit', edit_chancellor_path(chancellor) %></td>
<td><%= link_to 'Destroy', chancellor, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
By the way, in the folder layouts, i had to chance application by default: application.html.erb
<head>
<title>History</title>
<%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
Aucun commentaire:
Enregistrer un commentaire