2012-10-17 32 views
3
match "/myroute*" => redirect("http://google.com"), :as => :myroute 

線之上導致以下錯誤錯誤路由上在導軌中<code>routes.rb</code>重定向

/Users/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:349:in `on_error':  (Racc::ParseError) 
parse error on value ")" (RPAREN) 
    from /Users/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:99:in `_racc_do_parse_c' 
    from /Users/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:99:in `do_parse' 

看起來是因爲我添加一個通配符(*)。任何想法如何解決這個問題?

回答

0

試試這個:

match ':redirect' => redirect("http://google.com"), :as => :myroute , :constraints => { :redirect => /myroute.?/i }