I have the following controller method:
def update
approval = Approval.where(user: current_user, id: params[:id])
if approval.update_attributes(approved: params[:approved)
#success
else
#fail
end
respond_to do |format|
format.js { render :nothing => true }
end
end
How do I manage to send a success or fail from Rails to my AJAX call?