# Scaffold :foo versus ScaffoldGenerator

**URL:** <https://www.ruby-forum.com/t/scaffold-foo-versus-scaffoldgenerator/122404>\
**Category:** Rails\
**Created:** [December 7, 2007, 10:43am UTC](https://www.ruby-forum.com/t/scaffold-foo-versus-scaffoldgenerator/122404 "2007-12-07T10:43:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 7, 2007, 10:43am UTC](https://www.ruby-forum.com/t/scaffold-foo-versus-scaffoldgenerator/122404/1 "2007-12-07T10:43:34Z")

</div>

I don’t seem to have svn worked out totally, but most of the code is  
available at:

Basically, without running “script/generate scaffold post” how can I  
generate the scaffold for the posts model automagically? I sorta  
duplicated [http://wiki.rubyonrails.org/rails/pages/Scaffold](http://wiki.rubyonrails.org/rails/pages/Scaffold). If the  
answer is in that page, pardon, I didn’t see it ☹

(I want to keep my example a bit simpler than the above web page. My  
code availabe at [http://strawr.googlecode.com/svn/trunk/](http://strawr.googlecode.com/svn/trunk/), except I’m  
still working out subversion syntax so not everything uploaded.)

Here’s what I have:

thufir@arrakis ~/Desktop $  
thufir@arrakis ~/Desktop $ svn checkout  
[https://strawr.googlecode.com/svn/](https://strawr.googlecode.com/svn/)  
trunk/ strawr --username hawat.thufir

A strawr/test  
A strawr/test/unit  
A strawr/test/unit/item\_test.rb  
A strawr/test/unit/feed\_test.rb  
A strawr/test/unit/node\_test.rb  
A strawr/test/unit/category\_test.rb  
A strawr/test/test\_helper.rb  
A strawr/test/functional  
A strawr/test/functional/items\_controller\_test.rb  
A strawr/test/functional/categories\_controller\_test.rb  
A strawr/test/functional/feeds\_controller\_test.rb  
A strawr/test/functional/nodes\_controller\_test.rb  
A strawr/test/integration  
A strawr/test/fixtures  
A strawr/test/fixtures/items.yml  
A strawr/test/fixtures/categories.yml  
A strawr/test/fixtures/feeds.yml  
A strawr/test/fixtures/nodes.yml  
A strawr/test/mocks  
A strawr/test/mocks/test  
A strawr/test/mocks/development  
A strawr/tmp  
A strawr/tmp/pids  
A strawr/tmp/cache  
A strawr/tmp/sessions  
A strawr/tmp/sessions/ruby\_sess.17ca21e692236e6c  
A strawr/tmp/sockets  
A strawr/app  
A strawr/app/helpers  
A strawr/app/helpers/items\_helper.rb  
A strawr/app/helpers/application\_helper.rb  
A strawr/app/helpers/categories\_helper.rb  
A strawr/app/helpers/feeds\_helper.rb  
A strawr/app/helpers/nodes\_helper.rb  
A strawr/app/models  
A strawr/app/models/category.rb  
A strawr/app/models/item.rb  
A strawr/app/models/feed.rb  
A strawr/app/models/node.rb  
A strawr/app/controllers  
A strawr/app/controllers/application.rb  
A strawr/app/controllers/items\_controller.rb  
A strawr/app/controllers/categories\_controller.rb  
A strawr/app/controllers/feeds\_controller.rb  
A strawr/app/controllers/nodes\_controller.rb  
A strawr/app/views  
A strawr/app/views/layouts  
A strawr/app/views/layouts/items.rhtml  
A strawr/app/views/layouts/categories.rhtml  
A strawr/app/views/layouts/feeds.rhtml  
A strawr/app/views/layouts/nodes.rhtml  
A strawr/app/views/items  
A strawr/app/views/items/list.rhtml  
A strawr/app/views/items/show.rhtml  
A strawr/app/views/items/\_form.rhtml  
A strawr/app/views/items/edit.rhtml  
A strawr/app/views/items/new.rhtml  
A strawr/app/views/categories  
A strawr/app/views/categories/list.rhtml  
A strawr/app/views/categories/show.rhtml  
A strawr/app/views/categories/\_form.rhtml  
A strawr/app/views/categories/edit.rhtml  
A strawr/app/views/categories/new.rhtml  
A strawr/app/views/feeds  
A strawr/app/views/feeds/list.rhtml  
A strawr/app/views/feeds/show.rhtml  
A strawr/app/views/feeds/\_form.rhtml  
A strawr/app/views/feeds/edit.rhtml  
A strawr/app/views/feeds/new.rhtml  
A strawr/app/views/nodes  
A strawr/app/views/nodes/list.rhtml  
A strawr/app/views/nodes/show.rhtml  
A strawr/app/views/nodes/\_form.rhtml  
A strawr/app/views/nodes/edit.rhtml  
A strawr/app/views/nodes/new.rhtml  
A strawr/log  
A strawr/log/test.log  
A strawr/log/development.log  
A strawr/log/server.log  
A strawr/log/production.log  
A strawr/Rakefile  
A strawr/script  
A strawr/script/performance  
A strawr/script/performance/benchmarker  
A strawr/script/performance/profiler  
A strawr/script/console  
A strawr/script/breakpointer  
A strawr/script/server  
A strawr/script/destroy  
A strawr/script/runner  
A strawr/script/generate  
A strawr/script/about  
A strawr/script/plugin  
A strawr/script/process  
A strawr/script/process/spawner  
A strawr/script/process/inspector  
A strawr/script/process/reaper  
A strawr/config  
A strawr/config/routes.rb  
A strawr/config/database.yml  
A strawr/config/boot.rb  
A strawr/config/environment.rb  
A strawr/config/environments  
A strawr/config/environments/test.rb  
A strawr/config/environments/development.rb  
A strawr/config/environments/production.rb  
A strawr/doc  
A strawr/doc/README\_FOR\_APP  
A strawr/components  
A strawr/db  
A strawr/db/schema.rb  
A strawr/db/development.sqlite3  
A strawr/db/migrate  
A strawr/db/migrate/003\_items.rb  
A strawr/db/migrate/002\_categories.rb  
A strawr/db/migrate/001\_feeds.rb  
A strawr/db/migrate/004\_nodes.rb  
A strawr/lib  
A strawr/lib/tasks  
A strawr/vendor  
A strawr/vendor/plugins  
A strawr/README  
A strawr/public  
A strawr/public/dispatch.cgi  
A strawr/public/dispatch.rb  
A strawr/public/images  
A strawr/public/images/rails.png  
A strawr/public/robots.txt  
A strawr/public/dispatch.fcgi  
A strawr/public/500.html  
A strawr/public/javascripts  
A strawr/public/javascripts/prototype.js  
A strawr/public/javascripts/effects.js  
A strawr/public/javascripts/dragdrop.js  
A strawr/public/javascripts/application.js  
A strawr/public/javascripts/controls.js  
A strawr/public/index.html  
A strawr/public/404.html  
A strawr/public/.htaccess  
A strawr/public/stylesheets  
A strawr/public/stylesheets/scaffold.css  
A strawr/public/favicon.ico  
Checked out revision 5.  
thufir@arrakis ~/Desktop $  
thufir@arrakis ~/Desktop $ cd strawr  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ script/generate migration posts  
exists db/migrate  
create db/migrate/005\_posts.rb  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ nano db/migrate/005\_posts.rb  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ cat db/migrate/005\_posts.rb  
class Posts \< ActiveRecord::Migration  
def self.up  
create\_table :posts do |table|  
table.column :post :string  
end  
end

def self.down  
drop\_table :posts  
end  
end  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ rake db:migrate  
(in /home/thufir/Desktop/strawr)  
rake aborted!  
./db/migrate//005\_posts.rb:4: syntax error, unexpected ‘:’, expecting  
kEND  
table.column :post :string  
^

(See full trace by running task with --trace)  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ nano db/migrate/005\_posts.rb  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ cat db/migrate/005\_posts.rb  
class Posts \< ActiveRecord::Migration  
def self.up  
create\_table :posts do |table|  
table.column :post, :string  
end  
end

# def self.down drop\_table :posts end end thufir@arrakis ~/Desktop/strawr $ thufir@arrakis ~/Desktop/strawr $ rake db:migrate (in /home/thufir/Desktop/strawr) == Posts: migrating

# – create\_table(:posts) → 0.0141s == Posts: migrated (0.0143s)

thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ echo “script/generate scaffold post”  
script/generate scaffold post  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ svn ci  
Sending db/development.sqlite3  
Sending db/schema.rb  
Sending log/development.log  
Transmitting file data …  
Committed revision 6.  
thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 7, 2007, 11:18am UTC](https://www.ruby-forum.com/t/scaffold-foo-versus-scaffoldgenerator/122404/2 "2007-12-07T11:18:14Z")

</div>

On Fri, 07 Dec 2007 09:42:46 +0000, Thufir wrote:

> (I want to keep my example a bit simpler than the above web page. My  
> code availabe at [http://strawr.googlecode.com/svn/trunk/](http://strawr.googlecode.com/svn/trunk/), except I’m  
> still working out subversion syntax so not everything uploaded.)

## Got subversion squared away with “svn add \*”, "script/generate whatever

c" and “svn status | grep ?”. All very useful commands courtesy of the  
IRC group 🙂

thanks,

Thufir
