Tuesday, November 2, 2010

[Rails] Site displays as code?

Hi,

I'm completely new to ruby and working my way through the tutorial on
http://www.tutorialspoint.com/ruby-on-rails-2.1/

I've made a few pages to use, but when I open them in a web browser all
I see is code.

For instance, my new.html.erb, the code of which is:

-------------------------

<h1>Add new book</h1>
<% form_tag :action => 'create' do %>
<p><label for="book_title">Title</label>:
<%= text_field 'book', 'title' %></p>
<p><label for="book_price">Price</label>:
<%= text_field 'book', 'price' %></p>
<p><label for="book_subject">Subject</label>:
<%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p>
<p><label for="book_destription">Description</label><br/>
<%= submit_tag "Create" %>
<% end %>
<%= link_to 'Back', {:action => 'list'} %>

---------------------------------

shows up as:

----------------------------------

Add new book

<% form_tag :action => 'create' do %>
Title: <%= text_field 'book', 'title' %>

Price: <%= text_field 'book', 'price' %>

Subject: <%= collection_select(:book,:subject_id,@subjects,:id,:name) %>

Description
<%= submit_tag "Create" %> <% end %> <%= link_to 'Back', {:action =>
'list'} %>
---------------------------------

I thought maybe I should be pointing my browser to /new instead of
/new.html.erb, but all I get for that is a 404 error.

I feel like there's something simple I'm overlooking here, but I haven't
been able to find a solution anywhere online.

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate