Splitting Routes File Into Multiple Files

前端 未结 4 1571

I\'m working w/ a Rails 3 application and I want to split up the routes into separate files depending on the subdomain. Right now I have this in my routes.rb file:



        
4条回答
  •  青春惊慌失措
    2020-12-18 21:37

    We used this in our app:

        config.paths['config/routes'] = Dir["config/routes/*.rb"]
    

    If you try to access config.paths['config/routes'] normally, it returns the relative path to config/routes.rb, so by doing the above you're giving it relative paths to all of the files in your routes folder and removing the reference to config/routes.rb

提交回复
热议问题