Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
before_action :set_post, only: [:show, :edit, :update, :destroy]

def set_post
@post = Post.find(params[:id])
end
def set_post
@post = Post.find(params[:id])
end

def upvote
@posts = Post.find(params[:id])
@posts.votes.create
redirect_to(posts_path)
end
def upvote
@posts = Post.find(params[:id])
@posts.votes.create
redirect_to(posts_path)
end

def downvote
@posts = Post.find(params[:id])
@posts.votes.last.destroy
redirect_to(posts_path)
end
def downvote
@posts = Post.find(params[:id])
@posts.votes.last.destroy
redirect_to(posts_path)
end


def index
Expand Down