Skip to content

Commit

Permalink
第1巻第10章
Browse files Browse the repository at this point in the history
  • Loading branch information
kuroda committed Jul 30, 2011
1 parent 1f8ecb0 commit 2cf2561
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ def update
render :edit
end
end

def destroy
@book = Book.find(params[:id])
@book.destroy
redirect_to :books
end
end
6 changes: 5 additions & 1 deletion app/views/books/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<td><%= link_to book.title, book %></td>
<td><%= book.authors %></td>
<td><%= book.publish_year %></td>
<td><%= link_to "修正", [ :edit, book ] %></td>
<td>
<%= link_to "修正", [ :edit, book ] %>
<%= link_to "削除", book, :method => :delete,
:confirm => "本当に削除しますか? " %>
</td>
</tr>
<% end %>
</table>
Expand Down

0 comments on commit 2cf2561

Please sign in to comment.