Thank you for your kind comments. At first blush, I thought the problem was something simple like a setting or something a new user wouldn't automatically know, but would be obvious to ROR pros.
-- The bottom line is my code is supposed to be linking the user to the hello.html page, but it doesn't. It links them to the "root" of the site which causes it to load the index.html page. Not the intended result.
Here is what I have done, based on suggestions here.
1) Modified the Hello page 2 link code to include a reference to the controller
2) Added a "Hello page 3" link as suggested by Colin. It too renders a link to /demo and not to /demo/hello
3) Loaded the page in a different browser with a fresh cache
4) Rebooted my Mac, restarted MySql and Rails Server
5) Tried the page again and saw the same result
I don't get any errors or any sign that something is amiss. The code just renders href links to a destination other than what is desired.
Here is my current code:
index.html.erb
<h1>Demo#index</h1>
<p>Hello from index!</p>
<a href="/demo/hello">Hello page 1</a><br />
<%= link_to('Hello page 2', {:controller => 'demo', :action => 'hello'}) %><br /><br />
<%= link_to('Hello page 3', {:controller => 'demo', :action => 'hello'}) %><br />
hello.html.erb
<h1>Demo#hello</h1>
<p>Hello world!</p>
<%= 1+1 %>
<br />
<% target = "world" %>
<%= "Hello #{target}" %>
demo_controller.rb
class DemoController < ApplicationController
layout false
def index
render('index')
end
def hello
render('hello')
end
end
Here is what is being rendered when I load /demo/index
"." class="error"><h1>Demo#index</h1> <p>Hello from index!</p> <a href="/demo/hello">Hello page 1</a><br /> <a href="/demo">Hello page 2</a><br /><br /> <a href="/demo">Hello page 3</a><br />
Thanks again for the suggestions and help.
On Saturday, July 5, 2014 12:47:49 PM UTC-5, tamouse wrote:
On Saturday, July 5, 2014 12:47:49 PM UTC-5, tamouse wrote:
Can I just back up here and say your question is not simple, you should not be embarrassed to ask it, and it's quite appropriate. When doing online tutorials, and you get stuck like this, this is one of the places to come and ask. I'm glad you asked, and I'm glad you're taking the time to learn!
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/f01fe5e6-4735-4b1c-8652-8ab84e35af58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.