0

我在我的 rails 应用程序中的 griddler 添加的路线上遇到了一个奇怪的问题。

routes.rb 摘录:

# mount griddler using default path: /email_processor
post '/email_processor' => 'griddler/emails#create', as: :email_processor

耙路线

$ bundle exec rake routes RAILS_ENV=staging | grep -i 'email'
   email_processor POST     /email_processor(.:format)  griddler/emails#create

但是在暂存日志中,我看到路由错误。

 I, [2014-11-17T08:03:00.829592 #24344]  INFO -- : Started POST "/email_processor" for     198.37.144.147 at 2014-11-17 08:03:00 +0000
F, [2014-11-17T08:03:00.832265 #24344] FATAL -- :
ActionController::RoutingError (No route matches [POST] "/email_processor"):

当我试图从 rails 控制台识别路径时,我看到了同样的错误:

>  r = Rails.application.routes
 => #<ActionDispatch::Routing::RouteSet:0x0000000619f4f0>
> r.recognize_path "/email_processor"
ActionController::RoutingError: No route matches "/email_processor"

奇怪的是,在我的本地上一切正常(当我使用 ngrok 将本地公开到云时没有路由错误,发布请求正在按预期处理,但是我仍然看到本地的 recognise_path 问题)

宝石文件.rb

#Process incoming mail from sendgrid smtp server
gem 'griddler', "~> 1.1.0"
gem 'griddler-sendgrid', "~> 0.0.1"

Development.log 摘录:

Started POST "/email_processor" for 127.0.0.1 at 2014-11-15 14:02:22 +0530
  [1m[36mActiveRecord::SchemaMigration Load (0.9ms)[0m  [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
Processing by Griddler::EmailsController#create as HTML
..
Completed 200 OK in 63659ms (ActiveRecord: 4.0ms)

谁能帮我理解这个问题的根本原因?

谢谢

4

1 回答 1

0

我假设 nginx 重启是由 capistrano 脚本发生的(因为它没有在部署文档中明确提及)。没关系。重新启动 Nginx 完成了这项工作。

谢谢

于 2014-11-17T11:14:22.883 回答