Scaffold :foo versus ScaffoldGenerator

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. If the
answer is in that page, pardon, I didn’t see it :frowning:

(I want to keep my example a bit simpler than the above web page. My
code availabe at 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/
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

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/, 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 :slight_smile:

thanks,

Thufir