使用griddler gem时Rails路由错误

时间:2014-11-17 08:17:17

标签: ruby-on-rails rails-routing actiondispatch griddler

我在我的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问题)

Gemfile.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)

有人能帮我理解这个问题的根本原因吗?

由于

1 个答案:

答案 0 :(得分:0)

我假设通过capistrano脚本发生nginx重启(因为在部署文档中没有明确提到),我很愚蠢。没关系。重启Nginx完成了这项工作。

由于