Rails no.2

  create
  create app/controllers
  create app/helpers
  create app/models
  create app/views/layouts
  create config/environments
  create config/initializers
  create config/locales
  create db
  create doc
  create lib
  create lib/tasks
  create log
  create public/images
  create public/javascripts
  create public/stylesheets
  create script/performance
  create test/fixtures
  create test/functional
  create test/integration
  create test/performance
  create test/unit
  create vendor
  create vendor/plugins
  create tmp/sessions
  create tmp/sockets
  create tmp/cache
  create tmp/pids
  create Rakefile
  create README
  create app/controllers/application_controller.rb
  create app/helpers/application_helper.rb
  create config/database.yml
# SQLite version 3.x
  create config/routes.rb
  create config/locales/en.yml
  create db/seeds.rb
  create config/initializers/backtrace_silencers.rb
  create config/initializers/inflections.rb
  create config/initializers/mime_types.rb
  create config/initializers/new_rails_defaults.rb
class BookmarkBase < ActiveRecord::Migration
  create config/initializers/session_store.rb
  create config/environment.rb
  create config/boot.rb
  create config/environments/production.rb
  create config/environments/development.rb
  create config/environments/test.rb
  create script/about
  create script/console
  create script/dbconsole
  create script/destroy
  create script/generate
  create script/runner
  create script/server
  create script/plugin
  create script/performance/benchmarker
  create script/performance/profiler
  create test/test_helper.rb
  create test/performance/browsing_test.rb
  create public/404.html
  create public/422.html
  create public/500.html
  create public/index.html
  create public/favicon.ico
  create public/robots.txt
  create public/images/rails.png
  create public/javascripts/prototype.js
  create public/javascripts/effects.js
  create public/javascripts/dragdrop.js
  create public/javascripts/controls.js
  create public/javascripts/application.js
  create doc/README_FOR_APP
  create log/server.log
  create log/production.log
  create log/development.log
  create log/test.log

  • $ cd bookmark/
  • $ rm -f README
  • $ rm -f public/index.html
  • $ rm -f public/images/rails.png
  • $ vim config/database.yml

# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
 adapter: sqlite3
# database: db/development.sqlite3
 database: db/bookmark.sqlite3
 pool: 5
 timeout: 5000<<

  • $ script/generate migration bookmark_base

  create db/migrate
  create db/migrate/yyyymmddxxxxxx_bookmark_base.rb

  • $ vim db/migrate/yyyymmddxxxxxx_bookmark_base.rb

class BookmarkBase < ActiveRecord::Migration
 def self.up
  create_table :items do |t|
   t.column :title, :string
   t.column :url, :string
   t.column :user_id, :integer
   t.column :description, :text
   t.column :created_at, :datetime
  end
 end


 def self.down
  drop_table :items
 end
end

  • $ rake db:migrate

(in /Users/kudonbec/repos/git/StruggleRecord/bookmark)
== BookmarkBase: migrating ===================================================

    • create_table(:items)

-> 0.0014s
== BookmarkBase: migrated (0.0015s) ==========================================

  • $ script/generate scaffold item

  exists app/models/
  exists app/controllers/
  exists app/helpers/
  create app/views/items
  exists app/views/layouts/
  exists test/functional/
  exists test/unit/
  create test/unit/helpers/
  exists public/stylesheets/
  create app/views/items/index.html.erb
  create app/views/items/show.html.erb
  create app/views/items/new.html.erb
  create app/views/items/edit.html.erb
  create app/views/layouts/items.html.erb
  create public/stylesheets/scaffold.css
  create app/controllers/items_controller.rb
  create test/functional/items_controller_test.rb
  create app/helpers/items_helper.rb
  create test/unit/helpers/items_helper_test.rb
   route map.resources :items
 dependency model
  exists app/models/
  exists test/unit/
  exists test/fixtures/
  create app/models/item.rb
  create test/unit/item_test.rb
  create test/fixtures/items.yml
  exists db/migrate
  create db/migrate/yyyymmddxxxxxx_create_items.rb

  • $ script/server

=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server