Search code examples
ruby-on-railsrubyruby-on-rails-4.2

Seeking adivse/tutorial for RoR backend on subdomain


After searching a lot I wasn't able to find a decent recent guide on how to create a admin backend on a subdomain on a RoR project - ideally allowing me also to split app\frontend and app\backend into different folders without requiring to duplicate all controllers, views, ...

I want to separate all backend related from the front end and work on the backend from a subdomain as this gives me some extra security on the server side.

Please Notice: I do want to use atctive admin and other related gems for that.


Solution

  • This page

    http://guides.rubyonrails.org/routing.html

    which is the standard documentation for rails routing, shows you how to put your admin section in a namespace accessed via a subdomain, which i think is exactly what you want to do. See Section 3.9: "Request-based constraints".

    I found this by googling for "rails routes", going to the top result, and then doing a ctrl&f for "subdomain". This is the strategy i would recommend for most api questions.