提交 ac9a3a9d 编写于 作者: A Aaron Patterson

return early if we have a valid controller name

上级 996e9f56
......@@ -294,16 +294,16 @@ def check_controller!(controller)
end
return unless controller
return if controller =~ /\A[a-z_0-9][a-z_0-9\/]*\z/
if controller =~ %r{\A/}
raise ArgumentError, "controller name should not start with a slash"
end
if controller !~ /\A[a-z_0-9\/]*\z/
message = "controller name should not start with a slash"
else
message = "'#{controller}' is not a supported controller name. This can lead to potential routing problems."
message << " See http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use"
raise ArgumentError, message
end
raise ArgumentError, message
end
def blocks
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册