-1
使用ROR運行命令rake routes
時出現以下錯誤。獲取NoMethodError:未定義的ROR方法錯誤
Error:
NoMethodError: undefined method `resources' for nil:NilClass
C:/Sites/bookshelf/config/routes.rb:4:in `block (2 levels) in <top (required)>'
C:/Sites/bookshelf/config/routes.rb:3:in `block in <top (required)>'
C:/Sites/bookshelf/config/routes.rb:1:in `<top (required)>'
C:in `execute_if_updated'
C:/Sites/bookshelf/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)
我下面解釋我的代碼。
Rails.application.routes.draw do
root 'books#index'
resources :books do |book|
book.resources :comments, :only => :create
end
end
請幫我解決這個錯誤。