Rails in subdirectory: redirect_to '/' broke?


#1

Hi,

I’ve got my rails app in a subdirectory called ‘huisrekening/’. But
when I do this: redirect_to ‘/’. It redirects to ‘/’ and not to ‘/
huisrekening’ like I would like. Is it possible without doing
redirect_to ‘huisrekening/’ ?

Maybe something in environment.rb or something? I thought about using
a base href. But that’s a bit nasty too.

Thanks in advance!


#2

LeonB wrote:

I’ve got my rails app in a subdirectory called ‘huisrekening/’. But
when I do this: redirect_to ‘/’. It redirects to ‘/’ and not to ‘/
huisrekening’ like I would like. Is it possible without doing
redirect_to ‘huisrekening/’ ?

Rails won’t do anything to URLs given as strings for obvious reasons. I
guess it should work if you do

redirect_to(:controller => ‘home’, :action => ‘index’)

… assuming home/index is your front/home action.


Jakob S. - http://mentalized.net


#3

Thanks. This worked for me: :controller => ‘dashboard’, :action =>
‘index’
To bad about the slash, but it’s good enough. Thanks!