Adjust ajax and rails for intercommunication