Two-part Rails layouts -


There are two parts in my web pages, let's say above and below (excluding header and footer - all of these pages Are compatible). What is the best practice to dynamically generate those parts on the basis of action?

An approach with which I have come is for the above and partial viewing; Layout calls for the top partially in the yield and bottom.

This is the best way to make sure.

I think your opinion is fine. In your thoughts, you could:

  & lt;% - content_for: heading -%> [...] & lt;% - end -% & gt; & Lt;% - content_for: down -%> & Lt;% = Render @ partial_name% & gt; & Lt;% - end -% & gt;  

Of course you should check that there is partial existence and provide some default behavior. But I think you know about it.

And then in your layout:

  & lt; Div id = "top" & gt; & Lt;% = yield: top% & gt; & Lt; / Div & gt; & Lt; Div id = "down" & gt; & Lt;% = yield:% below & gt; & Lt; / Div & gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -