Rails - Ajax do not work properly on production server

329 views Asked by At

I have a very strange problem in my Ruby on Rails application. I have some controller that looks like this:

class ReportsController < ApplicationController
  include ActionController::Live
  #rest of the code

  def get_password
    @password = @report.password
  end
end

In my views I have this code:

%small{id: "report_password_#{report.id}"}
  %span= link_to '[Show Password]', get_password_report_path(report), remote: true

and I also have very simple get_password.js.erb file:

$("#report_password_<%[email protected] %>").html('<%= @password %>')

And now the problem is that on localhost everything works ok but after deploying to production when I click link Show Password it sometimes work, sometimes not...

When I made 2 fast clicks on link it will show the password. When I click on link application sends properly ajax request and get proper response but do not properly update div with password.

Do You have any ideas how to solve this problem?

0

There are 0 answers