UPDATE:
I’m getting this error:
(No route matches "/docs/index.html"... )
when accessing
admin.example.com/docs/index.html
The file exists.
In my routes.rb file:
map.with_options(:conditions => {:subdomain => 'admin']}) do |subdom|
subdom.root :controller => 'admin/subscriptions', :action => 'index'
subdom.with_options(:namespace => 'admin/', :name_prefix => 'admin_', :path_prefix => nil) do |admin|
admin.connect "/docs/:id", :controller => :docs, :action => :get_file
end
end
and the docs controller is in app/controllers/admin/
the only method in that controller
def get_file
path = request.request_uri
send_file(path)
end
END UPDATE
So, I have a subdomain, admin.example.com, that I would like to put YARD generated docs behind.
I tried just putting them in the public folder, and modifying the routes.rb file, but the docs were always accessible.
How do I make it so that they are only available once logged in to admin.example.com?
(all the href’s in the docs are relative, so, I’m not sure how I’d use controllers, either)
This is what your method should look like:
And your rails route should look like this: