快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱乐怡情怎么样_机器人论坛

和记娱乐怡情怎么样

当开始做Ruby on Rails实际编程时,对付初学者而言总会有些让人认为未知的Exception, 上次以手工要领写了一个简单的Rails Application, 本日下昼换用Red Rails对象编译器,和上次关于Rails设置设置设备摆设摆设完全相同 却呈现一个Exception: Routing Error. 详细截图如下:

提示Exception 信息:"No Route matches:/say/hello with {:method=>get}" .

Rails下两个目录Public/Config

Public目录

Rails框架是基于MVC架构的,在创建的项目Public目录中是我们要裸露给用户文件,此中包孕关键文件分发器-dispatcher. 此中包孕三个文件:dispatch.cgi/dispatch.fcgi/dispatch.rb.而分发器主要感化是: 认真接管用户从浏览器发送的哀求,并将这些哀求向导指定法度榜样的法度榜样代码, 也便是传送给MVC中Controller. 可以看出它是起向导哀求的感化.

Config目录

Config和记娱乐怡情怎么样目录顾名思义,是对全部Rails Application进行设置设置设备摆设摆设, 此中涉及数据库/运行情况,别的一个便是路由规则定义, 这个指定文件为routes.rb

而一样平常对付Routing Error这类非常应该首先查看Rails Application路由造访规则. 打开文件:

ActionController::Routing::Routes.draw do |map|

# The priority is based upon order of creation: first created -> highest priority.

# Sample resource route (maps HTTP verbs to controller actions automatically):

#map.resources :products

# You can have the root of your site route和记娱乐怡情怎么样d with map.root -- just remember to delete public/index.html.

# map.root :controller => "welcome"

# See how all your routes lay out with "rake routes"

# Install the default routes as the lowest priority.

# Note: These default routes make all actions和记娱乐怡情怎么样 in every controller accessible via GET requests. You should

# consider removing or commentin和记娱乐怡情怎么样g them out if you're using named routes and resources.

map.connect ':controller/:action/:id'

map.connect ':controller/:action/:id.:format'

end

您可能还会对下面的文章感兴趣: