I am trying to build a templating system which is in some ways similar to liquid but easier to use and less flexible/powerful.
Is there any way to render some inline content from the controller so that it also implements the layout erb file? So that I could render some custom content and it gets inserted into the main application theme?
The only way I can think of at the moment is to just add a one-liner in my view file that renders the inline content but this causes other problems.
If custom content is stored in the db then I want to render this inline (from the controller) within the layout but only if there is custom content otherwise I just want to render the normal view file.
Any ideas would be hugely appreciated!
You can do that in the controller:
Please note that if you don’t put the
:layout => "application", no template will be used.More info at http://guides.rubyonrails.org/layouts_and_rendering.html