par*_*lia 3 ruby-on-rails erb start-page
我index.html为我的项目页面需要一些Ruby代码,所以我需要将其更改为.erb扩展名.如何配置Rails以将index.html.erb文件标识为项目的起始页而不是index.html文件?
您需要map.root在config/routes.rb文件中配置路径.
map.root :controller => "blogs"
# This would recognize http://www.example.com/ as
params = { :controller => 'blogs', :action => 'index' }
# and provide these named routes
root_url # => 'http://www.example.com/'
root_path # => ''
Run Code Online (Sandbox Code Playgroud)
http://api.rubyonrails.org/classes/ActionController/Routing.html
| 归档时间: |
|
| 查看次数: |
5347 次 |
| 最近记录: |