I'm using Ruby on Rails 2.3.8. I've got a vote link that when you click it executes the following action:
def vote
render :update do |page|
page.select(".divbrian").each do |d|
page.replace_html d, "YA SEEE"
end
page.select('.d_voting_links_' + params[:post_id].to_s).each do |d|
page.replace_html d, :partial => 'post_votes/voted'
end
page.select('.d_vote_count_' + params[:post_id].to_s).each do |d|
page.replace_html d, Post.find(params[:post_id]).get_vote_count
end
end
end
In the HTML, there are as much divs of class "d_voting_links_" as posts displayed in the html page.
I don't know why, after I've installed Paperclip, Rails TinyMCE, and Hpricot plugins (all of them on the latest version), these ajax requests stopped working (really crazy).
I haven't changed anything of my code, I've even checked on my previous versions in which it works and nothing had changed, but those plugins.
I've also tried to created a simple div and calling it from the same action but it didn't recognize it (it does if I delete the "." from the request, but that will search for IDs, and I need to search for class).
Do you know about any known issue between those plugins and this ajax syntax? Or maybe...do you have a clue about what the problem could be?
I don't know why that block of code stopped working...but I've now figured out that without the page.select
block, it will work anyway and replace all of the divs with those class names.