Jon*_*atz 1 ruby-on-rails ruby-on-rails-3
我知道这似乎是一个非常简单的错误,但它来自一个复杂的过程.
我试图将旧的rails 2应用程序升级到rails 3.在我的routes.rb文件中,我有
root :to => "home#index"
Run Code Online (Sandbox Code Playgroud)
我还有一个文件'app/controllers/home_controller.rb'和'app/views/home/index.html.erb',所以我根本得不到可能导致此错误的原因.升级到rails 3并不容易.
(在home_controller.rb中,我有def index
end)
有什么建议?
**更新 - 完整的路线文件**
SpecimenTracker::Application.routes do
map.resources :users
map.resource :session
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end
# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
get "home/index"
root :to => "home#index"
# 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 the them or commenting them out if you're using named routes and resources.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
Run Code Online (Sandbox Code Playgroud)
"map.connect","map.resources"是旧语法
我的Rails 3 routes.rb以.开头
ApplicationName::Application.routes.draw do
Run Code Online (Sandbox Code Playgroud)
来自外部的Rails路由:http://guides.rubyonrails.org/routing.html
| 归档时间: |
|
| 查看次数: |
340 次 |
| 最近记录: |