views:

43

answers:

1

I'm trying to implement a voting system kind of like the one here on Stack Overflow. (Using Rails 3) I want the voting to be done without a page reload, so I have this code

link_to("/tags/#{tag.id}/upVote", :remote => true )

And so in my /views/tags directory I have a file called _upVote.js.erb that I thought would be called when this link is clicked, but it is not. It is trying to process upVote as HTML and this is the error I get

Missing template tags/upVote with {:formats=>[:html]

Also, here is what I have in my routes file

match "tags/:id/upVote" => "tags#upVote"

Any ideas how I can get this to work?

A: 

If you got this error message in a blank new page, that means that your remote call does not work and the call wasn't made via an Ajax request. You need to check that your layout correctly loads jQuery and the jQuery Rails connector available here : http://github.com/rails/jquery-ujs

Then use Firefox+Firebug to check that the call is really an Ajax call.

slainer68