title: How to prevent acts_as_votable from redirecting or refreshing? (Rails gem)
body: <p>I just set the acts_as_votable and its working properly but the problem is it redirecting to the post's link and when I add </p>
  
  <pre><code>redirect_to :back
  </code></pre>
  
  <p>It refreshes the page.</p>
  
  <p><strong>ADDED THE CODE</strong></p>
  
  <p>Here's the route.rb</p>
  
  <pre><code>Rails.application.routes.draw do
    #root 'pages#index'
    resources :posts
  
    devise_for :users
    # Define root URL
    root 'pages#index'
  
    # Define roots for pages
    get '/home' =&gt; 'pages#home'
  
    get '/user/:id' =&gt; 'pages#profile'
  
    get '/explore' =&gt; 'pages#explore'
  
    resources :posts do
      member do
        put "like", to: "posts#upvote"  # maybe change it to POSTS??
        put "dislike", to: "posts#downvote" # maybe change it to POSTS??
      end
      resources :comments
    end
  ######and post_cotroller.rb
  
  
  def upvote
      @post = Post.find(params[:id])
      @post.upvote_by current_user
      redirect_to :back
    end
  
    def downvote
    @post = Post.find(params[:id])
    @post.downvote_by current_user
    redirect_to :back
    end
  ##########and index
  
  &lt;%= link_to like_post_path(post), method: :put, class: 'upvote' do %&gt;
                      Upvote
                      &lt;%= post.get_upvotes.size %&gt;
                  &lt;% end %&gt;
  
                  &lt;%= link_to dislike_post_path(post), method: :put, class: 'downvote' do %&gt;
                      Downvote
                      &lt;%= post.get_downvotes.size %&gt;
                  &lt;% end %&gt;
  </code></pre>