Argent
Argent

Reputation: 293

Rails 4 Routing within Namespace

I am trying to set the base address www.myplace.com/admin to be directed to www.myplace.com/admin/adminhub within the namespace coding below. I have tried every combination I can think of, but to no avail. I was trying to follow the same code used for the / of the app.

namespace :admin do
    ...
    get "adminhub"
    get 'admin', to: 'adminhub'

  end

Upvotes: 0

Views: 228

Answers (1)

csexton
csexton

Reputation: 24813

Sounds like you want to redirect the browser to the new URL. You can do this with the redirect helper in the routes.

get '/admin', to: redirect('/admin/adminhub')

This allows you to redirect from one path to another. See the Redirection section in the Rails Routing Guide for more details.

Upvotes: 1

Related Questions