I create a simple .rhtml file “hello.rhtml” in the “view” folder of the
rails app.
Hello World
Hello World!
<%= 'Hello Dynamic World' %>
The problem is when I run the web server and load the url
“http://localhost:3000/say/hello”, only “Hello World!” is shown, the
second line ‘Hello Dynamic World’ is gone?
I create a simple .rhtml file “hello.rhtml” in the “view” folder of the
rails app.
Hello World
Hello World!
<%= 'Hello Dynamic World' %>
The problem is when I run the web server and load the url
“http://localhost:3000/say/hello”, only “Hello World!” is shown, the
second line ‘Hello Dynamic World’ is gone?
Anyone can help me? Thanks very very very much!
What does your generated HTML look like? What’s in your application
log?
I create a simple .rhtml file “hello.rhtml” in the “view” folder of the
rails app.
[…]
Ack! Didn’t notice this when posting the first time around…if you’re
using Rails 2.x, that should be hello.html.erb . If your tutorial is
using the .rhtml extension, then it’s out of date and you should follow
another tutorial.
I create a simple .rhtml file "hello.rhtml" in the
"view" folder of the
rails app.
[...]
Ack! Didn’t notice this when posting the first time around…if you’re
using Rails 2.x, that should be hello.html.erb . If your tutorial is
using the .rhtml extension, then it’s out of date and you should follow
another tutorial.
.rhtml works
fine at least through 2.2.2. .html.erb may be the way to go but .rhtml
is not the problem. The problem is what do you expect a string to do?Â
<%=Â %> says to evaluate the ruby expression and then return the
result. I think the code should be something like <%= p 'whatever'
%>.
Am I loosing my mind?
Norm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group. To post to this
group, send email to [email protected] To
unsubscribe from this group, send email to
[email protected] For more options,
visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
My rails is 2.3.4, I change the file “hello.rhtml” to “hello.html.erb”
But the browser still just show the first line, and doesn’t show
anything inside <%= XXX %>, do I miss something?
Make sure you have not got any other files hello.* in the view folder
(backup files for example). Some versions of Rails have been confused
by these. Temporarily remove hello.html.erb and make sure that it
then complains it cannot find the file. This will make sure it is
picking up the right one.
What does the generated html look like (View, Page Source or similar
in browser)? Post the relevant section here.
My rails is 2.3.4, I change the file “hello.rhtml” to “hello.html.erb”
But the browser still just show the first line, and doesn’t show
anything inside <%= XXX %>, do I miss something?
Many many thanks again
Marnen Laibow-Koser wrote:
Marnen Laibow-Koser wrote:
Browny L. wrote:
I create a simple .rhtml file “hello.rhtml” in the “view” folder of the
rails app.
[…]
Ack! Didn’t notice this when posting the first time around…if you’re
using Rails 2.x, that should be hello.html.erb . If your tutorial is
using the .rhtml extension, then it’s out of date and you should follow
another tutorial.
My rails is 2.3.4, I change the file “hello.rhtml” to “hello.html.erb”
But the browser still just show the first line, and doesn’t show
anything inside <%= XXX %>, do I miss something?
Make sure you have not got any other files hello.* in the view folder
(backup files for example). Some versions of Rails have been confused
by these. Temporarily remove hello.html.erb and make sure that it
then complains it cannot find the file. This will make sure it is
picking up the right one.
What does the generated html look like (View, Page Source or similar
in browser)? Post the relevant section here.
I run C:\Documents and Settings\brownylin\rails\my_app>rake routes
and the results are shown below three lines:
(in C:/Documents and Settings/brownylin/rails/my_app)
/:controller/:action/:id
/:controller/:action/:id(.:format)
OK, then that’s just the defaults. I’m not sure you’d be able to get
say/hello to work with just these routes. I assume you have an action
called hello in your SaysController class?
What does the routing problem mean? And what dose the three line output
means?