Rails Restful Routing and Subdomains

后端 未结 5 634
悲&欢浪女
悲&欢浪女 2020-12-28 17:57

I wondered if there were any plugins or methods which allow me to convert resource routes which allow me to place the controller name as a subdomain.

Examples:

5条回答
  •  囚心锁ツ
    2020-12-28 18:45

    I think that subdomain-fu plugin is exacly what you need. With it you will be able to generate routes like

    map.resources :universities,
        :controller => 'education_universities',
        :only => [:index, :show],
        :collection => {
            :all    => :get,
            :search => :post
        },
        :conditions => {:subdomain => 'education'}
    

    This will generate the following:

    education../universities GET
    education../universities/:id GET
    education../universities/all GET
    education../universities/search POST
    

提交回复
热议问题