Forum: Ruby on Rails Default Scaffolding Gives Errors

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David Ackerman (Guest)
on 2006-12-28 20:48
This is the default scaffolding for list.rhtml:

[code]
<h1>Listing <%= @scaffold_plural_name %></h1>

<table>
<tr>
<% for column in @scaffold_class.content_columns %>
<th><%= column.human_name %></th>
 <% end %>
</tr>

  <% for entry in instance_variable_get("@#{@scaffold_plural_name}") %>
<tr>
<% for column in @scaffold_class.content_columns %>
    <td><%= entry.send(column.name) %></td>
  <% end %>
      <td><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id
=> entry.id %></td>
      <td><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id
=> entry.id %></td>
      <td><%= link_to "Delete", :action => "destroy#{@scaffold_suffix}",
:id => entry.id %></td>
    </tr>
  <% end %>
  </table>

  <br />

  <%= link_to "New #{@scaffold_singular_name}", :action =>
"new#{@scaffold_suffix}" %>
[/code]

For some reason whenever I click on the the "Show", "Edit", or "Destroy"
links, I get a "Couldn't find Post without an ID" error. THat seems odd
because I have the entry.id right there, and for some reason it's not
linking to http://localhost:3000/blog/show/1, it just links to
/blod/show.

Any ideas?
David Ackerman (Guest)
on 2006-12-28 20:49
Also, when I try and manually access the ID's, like /blog/show/1, I get
this error:

Couldn't find Post with ID=1

What gives?
This topic is locked and can not be replied to.