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
Post a Comment