Re: [ocruby] iteration A1 in ebook: scaffold gets: routing e


#1

At 02:42 AM 6/6/2006, you wrote:

hi, on page 82 of second edition, getting stuck after

got past that, must have been doing something wrong. ended up writing
the script below:

thanks

set -x
base=i:/work
PATH=/cygdrive/$base:$PATH
name=depot
cd $base
rm -rf depot
ls
mysqladmin -f -u root drop ${name}_development
mysqladmin -u root create ${name}_development
mysqladmin -f -u root drop ${name}_test
mysqladmin -u root create ${name}_test
mysqladmin -f -u root drop ${name}_production
mysqladmin -u root create ${name}_production
echo rails
rails.cmd $name
cd $name
echo rake db:migrate
rake.bat db:migrate
echo script/generate model Product
ruby script/generate model Product
echo “edit migration file”
#read x
cat > $base/$name/db/migrate/001_create_products.rb << !!eof
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.column :title, :string
t.column :description, :text
t.column :image_url, :string
end
end
def self.down
drop_table :products
end
end
!!eof
echo rake db:migrate
rake.bat db:migrate
mysql -u root << !!eof
use ${name}_development;
show tables;
describe products;
!!eof
echo ruby script/generate controller admin
ruby script/generate controller admin
echo edit controller
cat > $base/$name/app/controllers/admin_controller.rb << !!eof
class AdminController < ApplicationController
scaffold :product
end
!!eof
echo starting server
ruby script/server


vice-chair http://ocjug.org/