I have an app that allows users to submit words. In development, users
can submit words, which are then voted on. Each user can only vote
once. This works fine in development.
However, when I deploy to my production server, users cannot seem to
vote. They click vote, and nothing happens.
This is killing and I don’t know what could be the problem. My code
for voting is below:
Voting Model
class Vote < ActiveRecord::Base
belongs_to :word, :counter_cache => true
belongs_to :user
validates_uniqueness_of :user_id, :scope => :word_id
end
Voting Controller
class VotesController < ApplicationController
before_filter :login_required
def create
@word = Word.find(params[:word_id])
@word.votes.create(:user => @current_user)
respond_to do |format|
format.html { redirect_to @word }
format.js
end
end
end
#Voting view (create)
page.replace_html ‘vote_score’, “Score: #{@word.reload.votes.size}”
page[:vote_score].visual_effect :highlight, :duration => 2.0
page[:vote_score].visual_effect :pulsate, :duration =>
1.5, :collection => @word.votes.latest
#voting view (edit)
page.replace_html ‘vote_score’, “Score: #{@word.votes.size}”
page[:vote_score].visual_effect :highlight, :duration => 2.0
page[:vote_score].visual_effect :pulsate, :duration => 1.5
I could really use some help. Thanks in advance.