【发布时间】:2015-08-10 13:40:24
【问题描述】:
当我在控制器中包含模块时,路由不起作用,报告404未找到错误,下面是我的代码,非常示例
ruby:2.0,rails:4.2.3
routes.rb
match ':controller(/:action(/:id))', via: :all
common.rb
module Common
class A; end
end
test_controller.rb
class TestController < ApplicationController
include Common # when I delete this line , this route '/test/hello' works as expected,
# otherwise rails reports 404 not found
def hello
render :json => {msg: 'hello'}
end
end
【问题讨论】:
标签: ruby-on-rails routes