relative path - Enforce trailing slash in Rails Routing -


adding trailing slash in links easy enough {:trailing_slash => true}, doesn't account if user types in non-slashed url. there way enforce trailing slashes via redirects in router?

get "/:controller/:id" => redirect{|params| "/#{params[:controller]}/#{params[:id]}/" } 

the above leads circular loop.

why?

a relative link of "./subclass" on

/parent/1 

is different than

/parent/1/ 

in config/application.rb file, add

config.action_controller.default_url_options = { :trailing_slash => true } 

in application class


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -