Rails makevoteable help creating user voting link and custom error message-Collection of common programming errors

I am having that problem with the gem makevoteable that when the page is loaded the post gets upvoted automatic. Instead of just having a link the user can click and upvote. When the page is reloaded I get the AlreadyVotedError in view. I would prefer a more user friendly error message as “You already voted this post”

My view:


  
  

UPDATE:

My route.rb: match 'stem_op/:id' => 'posts#vote_up', :as => 'stem_op'

My public controller:

def vote_up
  @post = Post.find(params[:id])
  current_user.up_vote(@post)
  flash[:message] = 'Thanks for voting!'
  redirect_to post_path(@post)
rescue MakeVoteable::Exceptions::AlreadyVotedError
  flash[:error] = 'Already voted!'
  redirect_to post_path(@post)
end

My view:


  
  

When I try to vote_up a post I get this error:

Template missing - Do I really need a blank view file?

UPDATE:

def vote_up
  @post = Post.find(params[:id])
  current_user.up_vote(@post)
  flash[:message] = 'Thanks for voting!'
  redirect_to post_path(@post)
rescue MakeVoteable::Exceptions::AlreadyVotedError
  flash[:error] = 'Already voted!'
  redirect_to post_path(@post)
end

Error:

SyntaxError in PostsController#vote_up

C:/Rails/den/app/controllers/posts_controller.rb:103: syntax error, unexpected keyword_end, expecting $end