Skip to content

Commit

Permalink
ranking now works, yaay
Browse files Browse the repository at this point in the history
  • Loading branch information
jadevance committed Jul 21, 2016
1 parent 9a8939a commit 07ce309
Show file tree
Hide file tree
Showing 4 changed files with 636 additions and 17 deletions.
3 changes: 2 additions & 1 deletion app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def destroy

def rank
@book = Book.find(params[:id])
@book.rank
rank = @book.rank += 1
@book.update(rank: rank)
redirect_to books_path
end
end
16 changes: 0 additions & 16 deletions app/views/books/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
<%= @book.title %>
<%= @book.author %>
<%= @book.rank %>

Edit

Delete

View All Movies

View All Media



<h1>
Title: <%= @book.title %>
</h1>
Expand All @@ -22,8 +8,6 @@ View All Media
Ranking: <%= @book.rank %>
</h3>

<p><%= @book.description %></p>

<%= link_to "Upvote", rank_book_path(@book.id), class: "btn btn-primary", method: :put %>
<%= link_to "Edit #{@book.title}", edit_book_path(@book.id), class: "btn btn-default" %>
<%= link_to "Delete", book_path(@book.id), class: "btn btn-danger", method: :delete %>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.
Loading

0 comments on commit 07ce309

Please sign in to comment.