2012-11-27 46 views
0

我正在嘗試創建一個靜態頁面。我輸入$ rails generate controller StaticPages home help --no-test-framework並得到了下面的輸出。覆蓋衝突app/controllers/static_pages_controller.rb?

conflict app/controllers/static_pages_controller.rb 
Overwrite 
/Users/themaktravels/rails_projects/sample_app/app/controllers/static_pages_controller.rb? (enter "h" for help) [Ynaqdh] d 
    class StaticPagesController < ApplicationController 
- def ... 
+ def home 
+ end 
+ 
+ def help 
    end 
    end 
Retrying... 

我試着看看有什麼不同,但我不熟悉這個來理解它們之間的區別。當我試圖不覆蓋文件,然後測試URL時,我的頁面上出現了這個錯誤。

Routing Error 

No route matches [GET] "/static_pages/home" 

Try running rake routes for more information on available routes. 

我然後試圖結帳我與GIT更改,然後試圖運行耙路線

bundle update rake 

bundle show rake 

require 'rake/dsl_definition' 

但我的靜態頁面還是顯示了一個錯誤。有什麼建議麼?謝謝!

+0

做耙路由時沒有什麼u得到?你有一個錯誤說沒有路線匹配最有可能你沒有提到路線文件中的任何路線。 –

回答

0

添加到您的routes文件

的config/routes.rb中

get "static_pages/home" 
get "static_pages/help" 

HTH