I'm still relatively new to Rails so please bear with me. How can I refresh the partial and stay at the page instead of rendering only the partial?
In _interaction.html.haml:
%div.vote_up.pull-left
= link_to('', vote_up_deal_path(deal), :method => :post,
:class => 'icon-thumbs-up interaction_button', :id => "vote_up_#{deal.id}")
In 'votes.js':
$.ajax({
type: 'POST',
url: '/deals/' + id + '/vote_up',
success: function() {
//do stuff
}
});
In my deals_controller.rb:
def vote_up
if user_signed_in?
current_user.vote_exclusively_for(@deal = Deal.find(params[:id]))
render :partial => 'deals/partials/interaction', :locals => {:deal => @deal}
end
end
This will redirect me to the page and render the partial instead of refreshing it like an AJAX request should.