Answer the question
In order to leave comments, you need to log in
Rails: How to add dynamic content to Layout?
Colleagues, please tell me the principle: how to add some dynamic content to application.html.erb in ruby? in the form of widgets / helpers or something else?
in particular, you need a website header that displays a list of cities from the database. How is this block made?
Answer the question
In order to leave comments, you need to log in
The problem is not entirely clear. Dynamic content can already be written in application.html.erb itself, as in any template. Ruby code can be inserted into the template inside the <%= %> tags (with output to the page) or <% %> (without output).
Perhaps you need to render the header through a parsial:
This code will include the markup from the header.html.erb file next to application.html.erb in its call site.
Accordingly, you can load different parsials depending on the parameters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question