I would like to set up a pair of style guides for the admin and public sections of a website.
Each will need its own layout which will contain a mixture of static ht
Actualy the answer is NO, you can't do it without a controller. But see some trivial workaround...
It's not very fair but should work:
Assuming you have FooController
with any logic you already have implemented. Now you want to render anypage.html.erb
without creating any special controller. Here is how:
Configure a route to your static page:
get '/your/static/page', to: 'foo#anypage'
Implement the view app/views/foo/anypage.html.erb
.
The problem is that it is impossible to change a path to your view. The path depends on the controller that you specify in a route (foo
in the example). Also note that it will be rendered with a specified for FooController
layout.
It should work by convention and you can read about it here.
UPDATE
Also I found very simmilar solution here. Using ApplicationController seems more reasonable for such pages. (Note that you needn't to create an action for it)