本文介绍了ahoy事件在Rails中发布错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用代码轨,我需要弄清楚这个问题.

I started code rails recently and I need to figure out this problem.

我特别在我的项目中使用此功能.因此,我自定义了名称和属性变量.

I use this function especially for my project. So i customize name and properties variables.

ahoy.track(name, properties);

在本地没有问题,但是在实时版本中,当跟踪方法运行时,我收到404错误.这行代码向/ahoy/events创建了一个POST请求,实时版本中没有路径/ahoy/events.

In local there is no problem but in the live version when the tracking method runs i received 404 error. This line create A POST request to /ahoy/events and there is no path /ahoy/events in the live version.

推荐答案

大家好,我尝试了很多,终于找到了解决方案.同时这个问题对我有很大帮助.

Hi everyone i try a lot and finally i found solution. Meanwhile this issue helped me a lot.

我仅修改项目中的两个文件.

I modify only two files in my project.

ahoy.rb

  mattr_accessor :auto_mount
  self.auto_mount = false

routes.rb

mount Ahoy::Engine => "/ahoy", as: :my_ahoy

这篇关于ahoy事件在Rails中发布错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 17:39