The Depot Application
23.5 Forms That Wrap Model Objects
21.2 Routing Requests
23.3 Helpers for Formatting, Linking, and Pagination
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/pager app/views
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/pager' -> `app/views/pager'
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/pager/user_list.erb' -> `app/views/pager/user_list.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/pager/user_list.html.erb' -> `app/views/pager/user_list.html.erb'
edit Gemfile
# source 'http://rubygems.org'
gem 'rails', :path => "/home/rubys/git/rails" # '3.0.15'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
gem 'will_paginate', '>= 3.0.pre'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
bundle show
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.15)
* actionpack (3.0.15)
* activemerchant (1.10.0)
* activemodel (3.0.15)
* activerecord (3.0.15)
* activeresource (3.0.15)
* activesupport (3.0.15)
* arel (2.0.10)
* braintree (2.16.0)
* builder (2.1.2)
* bundler (1.1.3)
* capistrano (2.12.0)
* erubis (2.6.6)
* haml (3.1.6)
* highline (1.6.13)
* htmlentities (4.3.1)
* i18n (0.5.0)
* jquery-rails (0.2.7)
* json (1.7.3)
* mail (2.2.19)
* mime-types (1.19)
* minitest (3.2.0)
* mysql (2.8.1)
* net-scp (1.0.4)
* net-sftp (2.0.5)
* net-ssh (2.5.2)
* net-ssh-gateway (1.1.0)
* polyglot (0.3.3)
* rack (1.2.5)
* rack-mount (0.6.14)
* rack-test (0.5.7)
* rails (3.0.15 def7543)
* railties (3.0.15)
* rake (0.9.2.2)
* rdoc (3.12)
* sqlite3 (1.3.6)
* test-unit (2.5.0)
* thor (0.14.6)
* treetop (1.4.10)
* tzinfo (0.3.33)
* will_paginate (3.0.3)
rails generate model user name:string
invoke active_record
create db/migrate/20120629192259_create_users.rb
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
Restart the server.
rake db:migrate
mv 20120629192259_create_users.rb 20110711000001_create_users.rb
== CreateUsers: migrating ====================================================
-- create_table(:users)
-> 0.0028s
== CreateUsers: migrated (0.0030s) ===========================================
echo "PagerController.new.populate" | IRBRC=tmp/irbrc rails console
Loading development environment (Rails 3.0.15)
>> PagerController.new.populate
=> 763
>>
get /pager/user_list
Name |
Adam Keys |
Andy Hunt |
Brian Marick |
Brian McCallister |
Chad Fowler |
Chris Pine |
Daniel Berger |
Dave Thomas |
David Heinemeier Hansson |
Eric Hodel |
Esther Derby |
Greg Wilson |
James Gray |
Jeffrey Fredrick |
Johanna Rothman |
Juliet Thomas |
Maik Schmidt |
Marcel Molina |
Mike Clark |
Mike Gunderloy |
Mike Mason |
Ryan Davis |
Scott Barron |
Scott Davis |
Thomas Fuchs |
ZZUser 000 |
ZZUser 001 |
ZZUser 002 |
ZZUser 003 |
ZZUser 004 |
get /pager/user_list?page=2
Name |
ZZUser 005 |
ZZUser 006 |
ZZUser 007 |
ZZUser 008 |
ZZUser 009 |
ZZUser 010 |
ZZUser 011 |
ZZUser 012 |
ZZUser 013 |
ZZUser 014 |
ZZUser 015 |
ZZUser 016 |
ZZUser 017 |
ZZUser 018 |
ZZUser 019 |
ZZUser 020 |
ZZUser 021 |
ZZUser 022 |
ZZUser 023 |
ZZUser 024 |
ZZUser 025 |
ZZUser 026 |
ZZUser 027 |
ZZUser 028 |
ZZUser 029 |
ZZUser 030 |
ZZUser 031 |
ZZUser 032 |
ZZUser 033 |
ZZUser 034 |
23.5 Forms That Wrap Model Objects
21.2 Routing Requests