ruby - redirection route to :back - rails -


i have in routes file

match "/:url" => redirect_to :back, constraints: { url: /^keys.*/ } 

but message error

routes.rb:132: syntax error, unexpected tsymbeg, expecting keyword_do or '{' or '(' (syntaxerror)   match "/:url" => redirect_to :back, constraints: { url: /^keys.*/ }                                 ^ 

where did go wrong ?

it's ambiguous, parentheses rescue!

match "/:url" => redirect_to(:back), constraints: { url: /^keys.*/ } 

update

regarding there no redirect_to, try:

match "/:url" => redirect{|params, request| request.env["http_referer"]}, constraints: { url: /^keys.*/ } 

i didn't tested code, let me know if wrong.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -