任何人都可以更正我的Ruby routes.rb语法错误吗?

时间:2014-06-18 18:38:13

标签: ruby-on-rails twitter-bootstrap routes

我正在尝试使用twitter-bootstrap导航栏,我在本教程的最后一步遇到了问题:http://johnnysky.com/tag/twitter-bootstrap

我尝试了他的确切代码并遇到了错误,所以我开始搞乱它试图修复它,这是我到目前为止在我的routes.rb:

  match '/search', to: =>'pages#search', via: 'get'

  match '/faq', to: =>'pages#faq', via: 'get'

  match '/my_account', to: =>'pages#my_account', via: 'get'

  match '/how_it_works', to: =>'pages#how_it_works', via: 'get'

  match '/contact_us', to: =>'pages#contact_us', via: 'get'

我收到的错误消息是:

   C:/CoOp/config/routes.rb:6: syntax error, unexpected ',', e
xpecting keyword_end
  match '/faq', to: =>'pages#faq', via: 'get'
                                  ^
C:/HandCoOp/project/HandCoOp/config/routes.rb:8: syntax error, unexpected =>
  match '/my_account', to: =>'pages#my_account', via: 'get'
                             ^
C:/HandCoOp/project/HandCoOp/config/routes.rb:8: syntax error, unexpected ',', e
xpecting keyword_end
  match '/my_account', to: =>'pages#my_account', via: 'get'
                                                ^
C:/HandCoOp/project/HandCoOp/config/routes.rb:10: syntax error, unexpected =>
  match '/how_it_works', to: =>'pages#how_it_works', via: 'get'
                               ^
C:/HandCoOp/project/HandCoOp/config/routes.rb:10: syntax error, unexpected ',',
expecting keyword_end
  match '/how_it_works', to: =>'pages#how_it_works', via: 'get'
                                                    ^
C:/HandCoOp/project/HandCoOp/config/routes.rb:12: syntax error, unexpected =>
  match '/contact_us', to: =>'pages#contact_us', via: 'get'
                             ^
C:/HandCoOp/project/HandCoOp/config/routes.rb:12: syntax error, unexpected ',',
expecting keyword_end
  match '/contact_us', to: =>'pages#contact_us', via: 'get'
                                                ^

有谁知道我哪里出错了?谢谢你看看我会继续寻找解决方案。干杯!

 match '/search', to: 'pages#search', via: 'get'

  match '/faq', to: 'pages#faq', via: 'get'

  match '/my_account', to: 'pages#my_account', via: 'get'

  match '/how_it_works', to: 'pages#how_it_works', via: 'get'

  match '/contact_us', to: 'pages#contact_us', via: 'get'

1 个答案:

答案 0 :(得分:2)

红宝石中的哈希使用json-esque风格

{key: value}

或传统的hashrocket

{key => value}

但是你正在使用两种语法的混合

to: => value

哪个不对。