Hello all. I've been working through some online tutorials, learning ROR
and have a question on scaffolding. Through the command promt i've ran
the command:
$ script/generate scaffold Albums
This created the controllers, helpers, models, and views.
I have a database table titled "albums" and have two records saved
within
The problem is that the scaffold command did not create what I had
expected it to create within my views. It only created partial code.
Below is the code it generated. The same goes for all my Albums views.
**************************************************************
<h1>Listing artists</h1>
<table>
<tr>
</tr>
<% @artists.each do |artist| %>
<tr>
<td><%= link_to 'Show', artist %></td>
<td><%= link_to 'Edit', edit_artist_path(artist) %></td>
<td><%= link_to 'Destroy', artist, :confirm => 'Are you sure?',
:method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New artist', new_artist_path %>
**************************************************************
When I view the page, it displays the "Show" "Edit" "Destroy" links, and
displays these for the number of items I have within the database. I
added an additional item to the database and the "Show" "Edit" "Destroy"
was displayed an additional time, making the total three to match the
number of records I have in the database table.
So i went one step further, and figured out that i'm missing the Table
Headings along with the elements to represent what data is supposed to
be displaed. For example, if I type <td><%=h album.id %></td>. Now the
id is displayed for each of the three records within the Albums table.
So, the question is, why isnt it filling out the code I had expected? I
have over come a lot of issues, mainly because of the tutorial i am
walking through is using an older version of ROR. This issue I cant find
an answer on. Anyone have any ideas that could point me in the right
direction?
Thanks!
--
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 [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.