I am trying to make a Ruby on Rails post via AJAX, and can't figure it out. So close!
HTML:
= link_to image_tag(current_user.votes.any? {|v| v.votable_id == post.id && v.value > 0} ? 'vote-up-selected.jpg' : 'vote-up.jpg'), vote_up_post_path(post)
CONTROLLER:
def vote_up
get_vote
@vote.value += 1 unless @vote.value == 1
@vote.save
respond_to do |format|
#format.html { render :action => 'vote_up', , :notice => "Voted Up." ) }
end
end
Sorry, this is a dumb question. I'm more so asking as to what the 'best' practice to doing this is.