This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 123651 - Add a bit more explanation of scaffolding
Summary: Add a bit more explanation of scaffolding
Status: RESOLVED FIXED
Alias: None
Product: usersguide
Classification: Unclassified
Component: Ruby (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: Chris Kutler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-07 19:21 UTC by Chris Kutler
Modified: 2008-03-25 23:43 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Kutler 2007-12-07 19:21:42 UTC
A reader writes:

"how bout the scaffolding itself? how can i customize the rhtml codes of the list view, show view, edit view etc..?in
the weblog you editted how the blogs will be listed so you had the list.rhtml for it, how did you get it?"

Below is my answer. Perhaps we can strengthen the short description of what scaffolding is, and how you can edit it,and
point to other resources.

To learn how to customize the .rhtml, try the second part of this series: http://www.netbeans.org/kb/60/ruby/model.html.
In that tutorial, you edit the show.rhtml file.

For example, I can open Views > blog > list.rhtml and change it to this:

<h1>My Ruby Blog</h1>

<% @posts.reverse.each do |post| %>
  <h2><%= post.title %></h2>
  <p style="background: blue; color: white;"><%= post.body %></p>
  <small> <%= link_to 'Permalink', :action => 'show', :id => post %></small>
  <hr>
<% end %>

<%= link_to 'Previous page', { :page => @post_pages.current.previous } if @post_pages.current.previous %>
<%= link_to 'Next page', { :page => @post_pages.current.next } if @post_pages.current.next %>

<br />

<%= link_to 'New post', :action => 'new' %>


You asked how to get the list.rhtml. In the Creating a Controller section, you edited the blog_controller.rb to add this
line

  scaffold :post


That Rails method creates automatically a simple set of views for creating, editing, viewing, and destroying entries. To
learn more go to http://wiki.rubyonrails.org/rails/pages/Scaffold
Comment 1 njeremy 2008-01-10 19:02:15 UTC
Will update for 6.1.
Comment 2 Chris Kutler 2008-03-25 23:43:18 UTC
The 6.1 version does not use the scaffold method. Instead it uses the 
Generate Scaffold tool. 

I added information about what happens when you generate
a scaffold. You also edit the views in the tutorial.