# Need Help: Deployment Issues with Voting App?

**URL:** <https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695>\
**Category:** Rails\
**Created:** [December 3, 2008, 1:18am UTC](https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695 "2008-12-03T01:18:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leximo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/839c29/32.png) [@Leximo](https://www.ruby-forum.com/u/Leximo)\
**Post date:** [December 3, 2008, 1:18am UTC](https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695/1 "2008-12-03T01:18:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Leximo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/839c29/32.png) [@Leximo](https://www.ruby-forum.com/u/Leximo)\
**Post date:** [December 3, 2008, 5:30am UTC](https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695/2 "2008-12-03T05:30:52Z")

</div>

On Tue, Dec 2, 2008 at 4:17 PM, Leximo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> class VotesController \< ApplicationController

Have you checked your production logs?

Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![Leximo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/839c29/32.png) [@Leximo](https://www.ruby-forum.com/u/Leximo)\
**Post date:** [December 4, 2008, 12:13am UTC](https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695/3 "2008-12-04T00:13:14Z")

</div>

This is what I get in the production log:

Processing VotesController#create (for 68.55.245.214 at 2008-12-03  
10:31:51) [POST]  
Session ID:  
BAh7CToMY3NyZl9pZCIlYTE4MWY4Y2JhMDY0OGE5MmRhYzNjNjUyMGUwZDhm  
ZmI6DnJldHVybl90byIGLzoMdXNlcl9pZGkGIgpmbGFzaElDOidBY3Rpb25D  
b250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–  
f46c64b9fe41d30837f158a9e54db829d9bd89ca  
Parameters: {“commit”=\>“Vote Yes”, “action”=\>“create”,  
“authenticity\_token”=\>"d7ce6906d1063ebd157e04d63445aee8f528$  
Rendering votes/create  
Completed in 0.01197 (83 reqs/sec) | Rendering: 0.00658 (54%) | DB:  
0.00068 (5%) | 200 OK [[sitename.org](http://sitename.org/words/$)

And this is what I get on my development server, where voting works:

Processing VotesController#create (for 127.0.0.1 at 2008-12-03  
11:15:25) [POST]  
Session ID:  
BAh7CDoMdXNlcl9pZGkLOgxjc3JmX2lkIiVkNzU3MTBlNTVkYjc5MTVkN2E1  
ZDQ4Y2RjZGViYzU2NSIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxh  
c2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==–06f3bc195feabf51948f37d7e1d3c2b6d0bbc554  
Parameters: {“commit”=\>“Vote Yes”, “action”=\>“create”,  
“authenticity\_token”=\>"9b269950803889f0fbfe230ed983bf102b92$  
^[[4;35;1mUser Columns (0.005002)^[[0m ^[[0mSHOW FIELDS FROM  
`users`^[[0m  
^[[4;36;1mUser Load (0.000246)^[[0m ^[[0;1mSELECT \* FROM `users`  
WHERE (`users`.`id` = 6) ^[[0m  
^[[4;35;1mWord Columns (0.016931)^[[0m ^[[0mSHOW FIELDS FROM  
`words`^[[0m  
^[[4;36;1mWord Load (0.006687)^[[0m ^[[0;1mSELECT \* FROM `words`  
WHERE (`words`.`id` = 104218) ^[[0m  
^[[4;35;1mVote Columns (0.030992)^[[0m ^[[0mSHOW FIELDS FROM  
`votes`^[[0m  
^[[4;36;1mSQL (0.001828)^[[0m ^[[0;1mBEGIN^[[0m  
^[[4;35;1mSQL (0.031889)^[[0m ^[[0mSELECT `user_id` FROM `votes`  
WHERE (`votes`.user\_id = 6 AND `votes`.word\_id$  
^[[4;36;1mVote Create (1.220428)^[[0m ^[[0;1mINSERT INTO `votes`  
(`updated_at`, `user_id`, `word_id`, `created_$ ^[[4;35;1mWord Load (0.002985)^[[0m ^[[0mSELECT * FROM `words` WHERE (`words`.`id`= 104218) ^[[0m ^[[4;36;1mWord Update (0.114667)^[[0m ^[[0;1mUPDATE`words`SET`votes\_count`=`votes\_count` + 1 WHERE (`id`=$ ^[[4;35;1mSQL (0.239631)^[[0m ^[[0mCOMMIT^[[0m Rendering votes/create ^[[4;36;1mWord Load (0.033487)^[[0m ^[[0;1mSELECT * FROM`words` WHERE (`words`.`id`= 104218) ^[[0m ^[[4;36;1mUser Load (0.000246)^[[0m ^[[0;1mSELECT * FROM`users` WHERE (`users`.`id`= 6) ^[[0m ^[[4;35;1mWord Columns (0.016931)^[[0m ^[[0mSHOW FIELDS FROM`words`^[[0m ^[[4;36;1mWord Load (0.006687)^[[0m ^[[0;1mSELECT * FROM `words` WHERE (`words`.`id`= 104218) ^[[0m ^[[4;35;1mVote Columns (0.030992)^[[0m ^[[0mSHOW FIELDS FROM`votes`^[[0m ^[[4;36;1mSQL (0.001828)^[[0m ^[[0;1mBEGIN^[[0m ^[[4;35;1mSQL (0.031889)^[[0m ^[[0mSELECT `user\_id`FROM`votes` WHERE (`votes`.user_id = 6 AND `votes`.word_id$ ^[[4;36;1mVote Create (1.220428)^[[0m ^[[0;1mINSERT INTO `votes` (`updated\_at`, `user\_id`, `word\_id`, `created\_$  
^[[4;35;1mWord Load (0.002985)^[[0m ^[[0mSELECT \* FROM `words`  
WHERE (`words`.`id` = 104218) ^[[0m  
^[[4;36;1mWord Update (0.114667)^[[0m ^[[0;1mUPDATE `words` SET  
`votes_count` = `votes_count` + 1 WHERE (`id` =$  
^[[4;35;1mSQL (0.239631)^[[0m ^[[0mCOMMIT^[[0m  
Rendering votes/create  
^[[4;36;1mWord Load (0.033487)^[[0m ^[[0;1mSELECT \* FROM `words`  
WHERE (`words`.`id` = 104218) ^[[0m  
^[[4;35;1mVote Load (0.000605)^[[0m ^[[0mSELECT \* FROM `votes`  
WHERE (`votes`.word\_id = 104218) ORDER BY id DES$  
Completed in 2.15566 (0 reqs/sec) | Rendering: 0.28268 (13%) | DB:  
1.70538 (79%) | 200 OK [[http://localhost/words/1$](http://localhost/words/1$)

Taking a look at this, I can see that the votes not being created on  
the production server. Maybe something is wrong with MySQL??

Any ideas?

---

<div class="post-metadata">

**Author:** ![Leximo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/839c29/32.png) [@Leximo](https://www.ruby-forum.com/u/Leximo)\
**Post date:** [December 3, 2008, 5:19pm UTC](https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695/4 "2008-12-03T17:19:43Z")

</div>

This is what I get in the production log:

Processing VotesController#create (for 68.55.245.214 at 2008-12-03  
10:31:51) [POST]  
Session ID:  
BAh7CToMY3NyZl9pZCIlYTE4MWY4Y2JhMDY0OGE5MmRhYzNjNjUyMGUwZDhm  
ZmI6DnJldHVybl90byIGLzoMdXNlcl9pZGkGIgpmbGFzaElDOidBY3Rpb25D  
b250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–  
f46c64b9fe41d30837f158a9e54db829d9bd89ca  
Parameters: {“commit”=\>“Vote Yes”, “action”=\>“create”,  
“authenticity\_token”=\>"d7ce6906d1063ebd157e04d63445aee8f528$  
Rendering votes/create  
Completed in 0.01197 (83 reqs/sec) | Rendering: 0.00658 (54%) | DB:  
0.00068 (5%) | 200 OK [[sitename.org](http://sitename.org/words/$)

And this is what I get on my development server, where voting works:

Processing VotesController#create (for 127.0.0.1 at 2008-12-03  
11:15:25) [POST]  
Session ID:  
BAh7CDoMdXNlcl9pZGkLOgxjc3JmX2lkIiVkNzU3MTBlNTVkYjc5MTVkN2E1  
ZDQ4Y2RjZGViYzU2NSIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxh  
c2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==–06f3bc195feabf51948f37d7e1d3c2b6d0bbc554  
Parameters: {“commit”=\>“Love it”, “action”=\>“create”,  
“authenticity\_token”=\>"9b269950803889f0fbfe230ed983bf102b92$  
^[[4;35;1mUser Columns (0.005002)^[[0m ^[[0mSHOW FIELDS FROM  
`users`^[[0m  
^[[4;36;1mUser Load (0.000246)^[[0m ^[[0;1mSELECT \* FROM `users`  
WHERE (`users`.`id` = 6) ^[[0m  
^[[4;35;1mWord Columns (0.016931)^[[0m ^[[0mSHOW FIELDS FROM  
`words`^[[0m  
^[[4;36;1mWord Load (0.006687)^[[0m ^[[0;1mSELECT \* FROM `words`  
WHERE (`words`.`id` = 104218) ^[[0m  
^[[4;35;1mVote Columns (0.030992)^[[0m ^[[0mSHOW FIELDS FROM  
`votes`^[[0m  
^[[4;36;1mSQL (0.001828)^[[0m ^[[0;1mBEGIN^[[0m  
^[[4;35;1mSQL (0.031889)^[[0m ^[[0mSELECT `user_id` FROM `votes`  
WHERE (`votes`.user\_id = 6 AND `votes`.word\_id$  
^[[4;36;1mVote Create (1.220428)^[[0m ^[[0;1mINSERT INTO `votes`  
(`updated_at`, `user_id`, `word_id`, `created_$ ^[[4;35;1mWord Load (0.002985)^[[0m ^[[0mSELECT * FROM `words` WHERE (`words`.`id`= 104218) ^[[0m ^[[4;36;1mWord Update (0.114667)^[[0m ^[[0;1mUPDATE`words`SET`votes\_count`=`votes\_count` + 1 WHERE (`id`=$ ^[[4;35;1mSQL (0.239631)^[[0m ^[[0mCOMMIT^[[0m Rendering votes/create ^[[4;36;1mWord Load (0.033487)^[[0m ^[[0;1mSELECT * FROM`words` WHERE (`words`.`id`= 104218) ^[[0m ^[[4;36;1mUser Load (0.000246)^[[0m ^[[0;1mSELECT * FROM`users` WHERE (`users`.`id`= 6) ^[[0m ^[[4;35;1mWord Columns (0.016931)^[[0m ^[[0mSHOW FIELDS FROM`words`^[[0m ^[[4;36;1mWord Load (0.006687)^[[0m ^[[0;1mSELECT * FROM `words` WHERE (`words`.`id`= 104218) ^[[0m ^[[4;35;1mVote Columns (0.030992)^[[0m ^[[0mSHOW FIELDS FROM`votes`^[[0m ^[[4;36;1mSQL (0.001828)^[[0m ^[[0;1mBEGIN^[[0m ^[[4;35;1mSQL (0.031889)^[[0m ^[[0mSELECT `user\_id`FROM`votes` WHERE (`votes`.user_id = 6 AND `votes`.word_id$ ^[[4;36;1mVote Create (1.220428)^[[0m ^[[0;1mINSERT INTO `votes` (`updated\_at`, `user\_id`, `word\_id`, `created\_$  
^[[4;35;1mWord Load (0.002985)^[[0m ^[[0mSELECT \* FROM `words`  
WHERE (`words`.`id` = 104218) ^[[0m  
^[[4;36;1mWord Update (0.114667)^[[0m ^[[0;1mUPDATE `words` SET  
`votes_count` = `votes_count` + 1 WHERE (`id` =$  
^[[4;35;1mSQL (0.239631)^[[0m ^[[0mCOMMIT^[[0m  
Rendering votes/create  
^[[4;36;1mWord Load (0.033487)^[[0m ^[[0;1mSELECT \* FROM `words`  
WHERE (`words`.`id` = 104218) ^[[0m  
^[[4;35;1mVote Load (0.000605)^[[0m ^[[0mSELECT \* FROM `votes`  
WHERE (`votes`.word\_id = 104218) ORDER BY id DES$  
Completed in 2.15566 (0 reqs/sec) | Rendering: 0.28268 (13%) | DB:  
1.70538 (79%) | 200 OK [[http://localhost/words/1$](http://localhost/words/1$)

Taking a look at this, I can see that the votes not being created on  
the production server. Maybe something is wrong with MySQL??

Any ideas?

---

<div class="post-metadata">

**Author:** ![Leximo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/839c29/32.png) [@Leximo](https://www.ruby-forum.com/u/Leximo)\
**Post date:** [December 4, 2008, 4:16am UTC](https://www.ruby-forum.com/t/need-help-deployment-issues-with-voting-app/154695/5 "2008-12-04T04:16:30Z")

</div>

Leximo wrote:

> Taking a look at this, I can see that the votes not being created on  
> the production server. Maybe something is wrong with MySQL??

It’s normal not to see database activity in production log.

Perhaps you should use create! rather than create to ensure  
that there are no problems inserting the vote.

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)
