Ruby on Rails
Saturday, January 13, 2018
Robert,
To amplify Hassan's answer a bit ... and you probably already know this ...
You can only have one head section and, I believe, it has to be the first tag after the html tag. If I remember correctly, most browsers will ignore misplaced head tags.
Rails will not look at the rendered text and say, "Oh my, Robert put in a head section. Let me move it immediately after the HTML tag."
Ralph Shnelvar
Saturday, January 13, 2018, 5:18:23 PM, you wrote:
| I can't set the title of a page no matter what I have tried to put in my .html.erb file >rails new testblah >bundle install <-- not necessary here but anyway. >rails generate controller abc def > rails s I go to http://127.0.0.1:3000 and I see the default template view .\app\views\abc\def.html.erb But even when I put <title>asdf</title> it doesn't change the title. Even if I do <html><head><title>asdf</title></head><body></body></html> it doesn't change the title. If I go to the rendered HTML of the page, I can see what it's doing.. Suppose my .\app\views\abc\def.html.erb is <html> <head><title>aaaaa</title></head> <body></body> </html> What gets rendered is this
So, what it is doing is rails is taking its own template then it dumps my template into its <body></body> So the title isn't getting set -- 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-talk+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-talk@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. |
Ralph
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment