Nima Izadi
Nima Izadi

Reputation: 1004

Prefix url helpers in subdomain constraints without having the prefix in the URL

Here is my routes.rb file :

  constraints subdomain: 'pro' do
    scope module: 'pro' do
      resources :subjects
    end
  end

This will generate:

   subjects GET /subjects(.:format) pro/subjects#index {:subdomain=>"pro"}

How can I have the pro_subject url helper without having the '/pro' prefix in the URL as I already have the subdomain.

I want people to type: http://pro.mysuperwebsite.com and not http://pro.mysuperwebsite.com/pro

Upvotes: 0

Views: 456

Answers (1)

OneChillDude
OneChillDude

Reputation: 8006

I'm pretty sure if you set the :path option, you can determine the subpath.

namespace :pro, :path => '' do # This should do it

Upvotes: 1

Related Questions