Forum: Ruby on Rails rails in subdirectory: redirect_to '/' broke?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1a9637acaccba514bf6c2cecf80c3f16?d=identicon&s=25 LeonB (Guest)
on 2007-03-20 00:37
(Received via mailing list)
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!
317aad7f9f0b69a440faca74bbe22b20?d=identicon&s=25 Jakob Skjerning (Guest)
on 2007-03-20 12:57
(Received via mailing list)
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 Skjerning - http://mentalized.net
1a9637acaccba514bf6c2cecf80c3f16?d=identicon&s=25 LeonB (Guest)
on 2007-03-20 23:54
(Received via mailing list)
Thanks. This worked for me: :controller => 'dashboard', :action =>
'index'
To bad about the slash, but it's good enough. Thanks!
This topic is locked and can not be replied to.