<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test15</title> | |
<meta name="csrf-param" content="authenticity_token" /> | |
<meta name="csrf-token" content="bDkNOUtlUKmlo1uzMRTqzCUCzBLX0q4/0NM8OfSXccoHocfYeZNFe+TsR8a4wvZhKakKRlXbU+NjWsnp4hNfXg==" /> | |
<link rel="stylesheet" media="all" href="/assets/abc.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1" data-turbolinks-track="reload" /> | |
<link rel="stylesheet" media="all" href="/assets/application.self-f0d704deea029cf000697e2c0181ec173a1b474645466ed843eb5ee7bb215794.css?body=1" data-turbolinks-track="reload" /> | |
<script src="/assets/rails-ujs.self-817d9a8cb641f7125060cb18fefada3f35339170767c4e003105f92d4c204e39.js?body=1" data-turbolinks-track="reload"></script> | |
<script src="/assets/turbolinks.self-2db6ec539b9190f75e1d477b305df53d12904d5cafdd47c7ffd91ba25cbec128.js?body=1" data-turbolinks-track="reload"></script> | |
<script src="/assets/abc.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js?body=1" data-turbolinks-track="reload"></script> | |
<script src="/assets/action_cable.self-69fddfcddf4fdef9828648f9330d6ce108b93b82b0b8d3affffc59a114853451.js?body=1" data-turbolinks-track="reload"></script> | |
<script src="/assets/cable.self-8484513823f404ed0c0f039f75243bfdede7af7919dda65f2e66391252443ce9.js?body=1" data-turbolinks-track="reload"></script> | |
<script src="/assets/application.self-eba3cb53a585a0960ade5a8cb94253892706bb20e3f12097a13463b1f12a4528.js?body=1" data-turbolinks-track="reload"></script> | |
</head> | |
<body> | |
<html> | |
<head><title>aaaaa</title></head> | |
<body></body> | |
</html> | |
</body> | |
</html> | |
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com. To post to this group, send email to rubyonra...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/aaa37d93-5198-4554-a440-0b9decbfee3f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. |
On Sat, Jan 13, 2018 at 4:18 PM, Robert Phillips
<robert.p...@gmail.com> wrote:
> So, what it is doing is rails is taking its own template then it dumps my template into its <body></body>
Yep, that's the way it works, though "template" is the wrong word.
This: http://guides.rubyonrails.org/layouts_and_rendering.html
may help.
If you want something within the scope of a layout like a title to be
dynamic you can assign the value in your controller and pass it in
as a variable, e.g. <title>@title</title>
If you want a dynamic page title you can put a line in the file such as
<%= render(:header_title) %>
in the head section of application.html., then you can use the following line in your underlying erb files
<% content_for(:header_title) do %>
<title>This is the page title</title>
<% end %>
What ever is in the block will be rendered in the header section (it could be html or JavaScript, or anything else that is valid where the render line is placed