2013-02-06 88 views
0

這是我的路由配置,下面我發佈了我收到的錯誤,當我試圖生成用戶模型。我在本教程的這一部分陷入困境,請幫忙!收件箱我,如果我沒有足夠具體,我是新來的這個世界!謝謝,麻煩您了!語法錯誤,意外tIDENTIFIER,期待keyword_end(static_pages?)

SampleApp::Application.routes.draw do 
    get "users/new" 
    root to: 'static_pages#home 

    match '/help', to:'static_pages#help' 
    match '/about', to:'static_pages#about' 
    match '/contact', to:'static_pages#contact' 
end 

    # You can have the root of your site routed with "root" 
    # just remember to delete public/index.html. 
    # root :to => "welcome#index" 

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

    # Sample of regular route: 
    # match 'products/:id' => 'catalog#view' 
    # Keep in mind you can assign values other than :controller and :action 

    # Sample of named route: 
    # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 
    # This route can be invoked with purchase_url(:id => product.id) 

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

    # Sample resource route with options: 
    # resources :products do 
    #  member do 
    #  get 'short' 
    #  post 'toggle' 
    #  end 
    # 
    #  collection do 
    #  get 'sold' 
    #  end 
    # end 

    # Sample resource route with sub-resources: 
    # resources :products do 
    #  resources :comments, :sales 
    #  resource :seller 
    # end 

    # Sample resource route with more complex sub-resources 
    # resources :products do 
    #  resources :comments 
    #  resources :sales do 
    #  get 'recent', :on => :collection 
    # end 
    # end 

    # Sample resource route within a namespace: 
    # namespace :admin do 
    #  # Directs /admin/products/* to Admin::ProductsController 
    #  # (app/controllers/admin/products_controller.rb) 
    #  resources :products 
    # end 

    # You can have the root of your site routed with "root" 
    # just remember to delete public/index.html. 
    # root :to => 'welcome#index' 

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

    # This is a legacy wild controller route that's not recommended for RESTful  applications. 
    # Note: This route will make all actions in every controller accessible via GET requests. 
    # match ':controller(/:action(/:id))(.:format)' 

這正顯示出此錯誤

unknown00231256eabc:sample_app micahsherman$ rails generate model User name:string  email:string 
/Users/micahsherman/.rvm/gems/[email protected]/gems/activesupport- 3.2.11/lib/active_support/dependencies.rb:245:in `load':  /Users/micahsherman/rails_projects/sample_app/config/routes.rb:5: syntax error, unexpected  tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError) 
    match '/help', to:'static_pages#help' 
     ^
/Users/micahsherman/rails_projects/sample_app/config/routes.rb:5: syntax error, unexpected tIDENTIFIER, expecting keyword_end 
    match '/help', to:'static_pages#help' 
          ^
    from /Users/micahsherman/.rvm/gems/ruby-1.9.3- [email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load' 
    from /Users/micahsherman/.rvm/gems/ruby-1.9.3- [email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `each' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
    from /Users/micahsherman/.rvm/gems/ruby-1.9.3- [email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:16:in `reload!' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:26:in `block in updater' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb:78:in `call' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb:78:in `execute' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:27:in `updater' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /Users/micahsherman/rails_projects/sample_app/config/environment.rb:5:in `<top (required)>' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application.rb:103:in `require' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!' 
    from /Users/micahsherman/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/commands.rb:25:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 
+3

多麼可愛。該stackoverflow語法突出顯示回答了這個問題。考慮使用具有語法高亮,代碼縮進和其他有用功能的編輯器。 – 2013-02-06 23:35:33

回答

4

你在這裏缺少一個右單引號:

root to: 'static_pages#home 
相關問題