The Depot Application

The Depot Application

Table of Contents 25.1 Sending E-mail

26 Active Resources

</ActiveResource::Redirection: Failed.* 302/> expected but was
<"      create  ">.

Traceback:
  /home/rubys/git/awdwr/work-188-236/vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb:307:in `assert_select'
  /home/rubys/git/awdwr/checkdepot.rb:1147

Restart the server.

ruby -rubygems /home/rubys/git/rails/railties/bin/rails depot_client
      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
      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
      create  config/initializers/session_store.rb
      create  config/initializers/cookie_verification_secret.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
edit app/models/product.rb
class Product < ActiveResource::Base
  self.site = 'http://dave:secret@localhost:3000/'
end
echo "Product.find(2).title" | IRBRC=tmp/irbrc ruby script/console
*** glibc detected *** irb: realloc(): invalid next size: 0x081e52f0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb75c2803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb75c475b]
irb(ruby_xrealloc+0x56)[0x8075696]
irb(rb_str_resize+0x53)[0x80bfcc3]
irb[0x80721c7]
irb(rb_find_file_ext+0x1d2)[0x8072a32]
irb(rb_require_safe+0x12d)[0x806726d]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x8067be6]
irb[0x806806b]
irb[0x8059334]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x805ef39]
irb[0x806b95e]
irb(rb_yield+0x21)[0x806cdc1]
irb(rb_ary_each+0x31)[0x80d1c51]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x8060e11]
irb[0x80618ce]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x806d630]
irb(ruby_exec+0x16)[0x806d656]
irb(ruby_run+0x21)[0x806d9a1]
irb[0x805527f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb756b450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08103000-081f8000 rw-p 08103000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b7441000-b746e000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b746e000-b7471000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b7471000-b749d000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b749d000-b74a1000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b74a1000-b74a2000 rw-p b74a1000 00:00 0 
b74b2000-b753d000 rw-p b74b2000 00:00 0 
b753d000-b7551000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7551000-b7553000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7553000-b7555000 rw-p b7553000 00:00 0 
b7555000-b769e000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b769e000-b769f000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b769f000-b76a1000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76a1000-b76a4000 rw-p b76a1000 00:00 0 
b76a4000-b76c7000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76c7000-b76c9000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76c9000-b76d2000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76d2000-b76d4000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76d4000-b76fc000 rw-p b76d4000 00:00 0 
b76fc000-b76fe000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b76fe000-b7700000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b7700000-b7707000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7707000-b7709000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7709000-b7713000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b7713000-b7714000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b7714000-b7718000 r-xp 00000000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7718000-b7719000 rw-p 00003000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7719000-b771b000 rw-p b7719000 00:00 0 
b771b000-b771c000 r-xp b771b000 00:00 0          [vdso]
b771c000-b7736000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b7736000-b7738000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfd8f000-bfda4000 rw-p bffeb000 00:00 0          [stack]
Aborted
edit app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
    layout "store"
  before_filter :authorize, :except => :login
  #...
 
 
protected
  def authorize
    unless User.find_by_id(session[:user_id])
      if session[:user_id] != :logged_out
        authenticate_or_request_with_http_basic('Depot') do |username, password|
          user = User.authenticate(username, password)
          session[:user_id] = user.id if user
        end
      else
        flash[:notice] = "Please log in"
        redirect_to :controller => 'admin', :action => 'login'
      end
    end
  end
 
  def set_locale
    session[:locale] = params[:locale] if params[:locale]
    I18n.locale = session[:locale] || I18n.default_locale
 
    locale_path = "#{LOCALES_DIRECTORY}#{I18n.locale}.yml"
 
    unless I18n.load_path.include? locale_path
      I18n.load_path << locale_path
      I18n.backend.send(:init_translations)
    end
 
  rescue Exception => err
    logger.error err
    flash.now[:notice] = "#{I18n.locale} translation not available"
 
    I18n.load_path -= [locale_path]
    I18n.locale = session[:locale] = I18n.default_locale
  end
end
edit app/controllers/admin_controller.rb
class AdminController < ApplicationController
 
  # just display the form and wait for user to
  # enter a name and password
  def login
    if request.post?
      user = User.authenticate(params[:name], params[:password])
      if user
        session[:user_id] = user.id
        redirect_to(:action => "index")
      else
        flash.now[:notice] = "Invalid user/password combination"
      end
    end
  end
 
  def logout
    session[:user_id] = :logged_out
    flash[:notice] = "Logged out"
    redirect_to(:action => "login")
  end
 
  def index
    @total_orders = Order.count
  end
end
edit app/controllers/line_items_controller.rb
  def create
    params[:line_item][:order_id] ||= params[:order_id]
    @line_item = LineItem.new(params[:line_item])
 
    respond_to do |format|
      if @line_item.save
        format.html { redirect_to(@line_item, :notice => 'LineItem was successfully created.') }
        format.xml  { render :xml => @line_item, :status => :created,
                             :location => @line_item }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @line_item.errors,
                             :status => :unprocessable_entity }
      end
    end
  end
edit config/routes.rb
ActionController::Routing::Routes.draw do |map|
  map.resources :users
 
  map.resources :line_items
 
  map.resources :orders, :has_many => :line_items
 
  map.resources :products
 
  # The priority is based upon order of creation: first created -> highest priority.
 
  # Sample of regular route:
  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action
 
  # Sample of named route:
  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)
 
  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   map.resources :products
 
  # Sample resource route with options:
  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
 
  # Sample resource route with sub-resources:
  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
  # Sample resource route with more complex sub-resources
  #   map.resources :products do |products|
  #     products.resources :comments
  #     products.resources :sales, :collection => { :recent => :get }
  #   end
 
  # Sample resource route within a namespace:
  #   map.namespace :admin do |admin|
  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  #     admin.resources :products
  #   end
 
  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  # map.root :controller => "welcome"
 
  # See how all your routes lay out with "rake routes"
 
  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing or commenting them out if you're using named routes and resources.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

Restart the server.

echo "Product.find(2).title" | IRBRC=tmp/irbrc ruby script/console
*** glibc detected *** irb: realloc(): invalid next size: 0x081e52f0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb75db803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb75dd75b]
irb(ruby_xrealloc+0x56)[0x8075696]
irb(rb_str_resize+0x53)[0x80bfcc3]
irb[0x80721c7]
irb(rb_find_file_ext+0x1d2)[0x8072a32]
irb(rb_require_safe+0x12d)[0x806726d]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x8067be6]
irb[0x806806b]
irb[0x8059334]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x805ef39]
irb[0x806b95e]
irb(rb_yield+0x21)[0x806cdc1]
irb(rb_ary_each+0x31)[0x80d1c51]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x8060e11]
irb[0x80618ce]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x806d630]
irb(ruby_exec+0x16)[0x806d656]
irb(ruby_run+0x21)[0x806d9a1]
irb[0x805527f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7584450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08103000-081f8000 rw-p 08103000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b745a000-b7487000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b7487000-b748a000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b748a000-b74b6000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b74b6000-b74ba000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b74ba000-b74bb000 rw-p b74ba000 00:00 0 
b74cb000-b7556000 rw-p b74cb000 00:00 0 
b7556000-b756a000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b756a000-b756c000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b756c000-b756e000 rw-p b756c000 00:00 0 
b756e000-b76b7000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76b7000-b76b8000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76b8000-b76ba000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76ba000-b76bd000 rw-p b76ba000 00:00 0 
b76bd000-b76e0000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76e0000-b76e2000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76e2000-b76eb000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76eb000-b76ed000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76ed000-b7715000 rw-p b76ed000 00:00 0 
b7715000-b7717000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b7717000-b7719000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b7719000-b7720000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7720000-b7722000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7722000-b772c000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b772c000-b772d000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b772d000-b7731000 r-xp 00000000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7731000-b7732000 rw-p 00003000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7732000-b7734000 rw-p b7732000 00:00 0 
b7734000-b7735000 r-xp b7734000 00:00 0          [vdso]
b7735000-b774f000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b774f000-b7751000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfdb2000-bfdc7000 rw-p bffeb000 00:00 0          [stack]
Aborted
echo "p = Product.find(2)\\nputs p.price\\np.price-=5\\np.save" | IRBRC=tmp/irbrc ruby script/console
*** glibc detected *** irb: realloc(): invalid next size: 0x081e52f0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb75f2803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb75f475b]
irb(ruby_xrealloc+0x56)[0x8075696]
irb(rb_str_resize+0x53)[0x80bfcc3]
irb[0x80721c7]
irb(rb_find_file_ext+0x1d2)[0x8072a32]
irb(rb_require_safe+0x12d)[0x806726d]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x8067be6]
irb[0x806806b]
irb[0x8059334]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x805ef39]
irb[0x806b95e]
irb(rb_yield+0x21)[0x806cdc1]
irb(rb_ary_each+0x31)[0x80d1c51]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x8060e11]
irb[0x80618ce]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x806d630]
irb(ruby_exec+0x16)[0x806d656]
irb(ruby_run+0x21)[0x806d9a1]
irb[0x805527f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb759b450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08103000-081f8000 rw-p 08103000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b7471000-b749e000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b749e000-b74a1000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b74a1000-b74cd000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b74cd000-b74d1000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b74d1000-b74d2000 rw-p b74d1000 00:00 0 
b74e2000-b756d000 rw-p b74e2000 00:00 0 
b756d000-b7581000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7581000-b7583000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7583000-b7585000 rw-p b7583000 00:00 0 
b7585000-b76ce000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76ce000-b76cf000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76cf000-b76d1000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76d1000-b76d4000 rw-p b76d1000 00:00 0 
b76d4000-b76f7000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76f7000-b76f9000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76f9000-b7702000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7702000-b7704000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7704000-b772c000 rw-p b7704000 00:00 0 
b772c000-b772e000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b772e000-b7730000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b7730000-b7737000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7737000-b7739000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7739000-b7743000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b7743000-b7744000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b7744000-b7748000 r-xp 00000000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7748000-b7749000 rw-p 00003000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7749000-b774b000 rw-p b7749000 00:00 0 
b774b000-b774c000 r-xp b774b000 00:00 0          [vdso]
b774c000-b7766000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b7766000-b7768000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bffcb000-bffe0000 rw-p bffeb000 00:00 0          [stack]
Aborted
get /store
Home
Questions
News
Contact

Your Pragmatic Catalog

Auto

Pragmatic Project Automation

Pragmatic Project Automation shows you how to improve the consistency and repeatability of your project's procedures using automation to reduce risk and errors.

Simply put, we're going to put this thing called a computer to work for you doing the mundane (but important) project stuff. That means you'll have more time and energy to do the really exciting---and difficult---stuff, like writing quality code.

$29.95
<!-- START_HIGHLIGHT --> <!-- END_HIGHLIGHT -->
Utc

Pragmatic Unit Testing (C#)

Pragmatic programmers use feedback to drive their development and personal processes. The most valuable feedback you can get while coding comes from unit testing.

Without good tests in place, coding can become a frustrating game of "whack-a-mole." That's the carnival game where the player strikes at a mechanical mole; it retreats and another mole pops up on the opposite side of the field. The moles pop up and down so fast that you end up flailing your mallet helplessly as the moles continue to pop up where you least expect them.

$27.75
<!-- START_HIGHLIGHT --> <!-- END_HIGHLIGHT -->
Svn

Pragmatic Version Control

This book is a recipe-based approach to using Subversion that will get you up and running quickly---and correctly. All projects need version control: it's a foundational piece of any project's infrastructure. Yet half of all project teams in the U.S. don't use any version control at all. Many others don't use it well, and end up experiencing time-consuming problems.

$28.50
<!-- START_HIGHLIGHT --> <!-- END_HIGHLIGHT -->
edit app/models/order.rb
class Order < ActiveResource::Base
  self.site = 'http://dave:secret@localhost:3000/'
end
echo "Order.find(1).name\\nOrder.find(1).line_items\\n" | IRBRC=tmp/irbrc ruby script/console
*** glibc detected *** irb: realloc(): invalid next size: 0x081e52d0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb762f803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb763175b]
irb(ruby_xrealloc+0x56)[0x8075696]
irb(rb_str_resize+0x53)[0x80bfcc3]
irb[0x80721c7]
irb(rb_find_file_ext+0x1d2)[0x8072a32]
irb(rb_require_safe+0x12d)[0x806726d]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x8067be6]
irb[0x806806b]
irb[0x8059334]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x805ef39]
irb[0x806b95e]
irb(rb_yield+0x21)[0x806cdc1]
irb(rb_ary_each+0x31)[0x80d1c51]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x8060e11]
irb[0x80618ce]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x806d630]
irb(ruby_exec+0x16)[0x806d656]
irb(ruby_run+0x21)[0x806d9a1]
irb[0x805527f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb75d8450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08103000-081f8000 rw-p 08103000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b74ae000-b74db000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b74db000-b74de000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b74de000-b750a000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b750a000-b750e000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b750e000-b750f000 rw-p b750e000 00:00 0 
b751f000-b75aa000 rw-p b751f000 00:00 0 
b75aa000-b75be000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75be000-b75c0000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75c0000-b75c2000 rw-p b75c0000 00:00 0 
b75c2000-b770b000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b770b000-b770c000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b770c000-b770e000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b770e000-b7711000 rw-p b770e000 00:00 0 
b7711000-b7734000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7734000-b7736000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7736000-b773f000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b773f000-b7741000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7741000-b7769000 rw-p b7741000 00:00 0 
b7769000-b776b000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b776b000-b776d000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b776d000-b7774000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7774000-b7776000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7776000-b7780000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b7780000-b7781000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b7781000-b7785000 r-xp 00000000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7785000-b7786000 rw-p 00003000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7786000-b7788000 rw-p b7786000 00:00 0 
b7788000-b7789000 r-xp b7788000 00:00 0          [vdso]
b7789000-b77a3000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b77a3000-b77a5000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfb0d000-bfb22000 rw-p bffeb000 00:00 0          [stack]
Aborted
edit app/models/line_item.rb
class LineItem < ActiveResource::Base
  self.site = 'http://dave:secret@localhost:3000/orders/:order_id'
end
get /admin/logout
HTTP Basic: Access denied.
get /admin/login
<fieldset> <legend>Please Log In</legend> <div> <label for="name">Name:</label> </div> <div> <label for="password">Password:</label> </div> <div> </div> </fieldset>
post /admin/login
You are being redirected.
get http://localhost:3000/admin

Welcome

It's Sun May 23 18:32:03 -0400 2010 We have 2 orders.
get /orders/1/line_items.xml
<?xml version="1.0" encoding="UTF-8"?>
<line-items type="array">
  <line-item>
    <created-at type="datetime">2010-05-23T22:22:45Z</created-at>
    <id type="integer">1</id>
    <order-id type="integer">1</order-id>
    <product-id type="integer">3</product-id>
    <quantity type="integer">1</quantity>
    <total-price type="decimal">28.5</total-price>
    <updated-at type="datetime">2010-05-23T22:22:45Z</updated-at>
  </line-item>
  <line-item>
    <created-at type="datetime">2010-05-23T22:24:14Z</created-at>
    <id type="integer">2</id>
    <order-id type="integer">2</order-id>
    <product-id type="integer">2</product-id>
    <quantity type="integer">2</quantity>
    <total-price type="decimal">59.9</total-price>
    <updated-at type="datetime">2010-05-23T22:24:14Z</updated-at>
  </line-item>
</line-items>
echo "LineItem.find(:all, :params => {:order_id=>1})" | IRBRC=tmp/irbrc ruby script/console
*** glibc detected *** irb: realloc(): invalid next size: 0x081e52f0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb75f2803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb75f475b]
irb(ruby_xrealloc+0x56)[0x8075696]
irb(rb_str_resize+0x53)[0x80bfcc3]
irb[0x80721c7]
irb(rb_find_file_ext+0x1d2)[0x8072a32]
irb(rb_require_safe+0x12d)[0x806726d]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x8067be6]
irb[0x806806b]
irb[0x8059334]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x805ef39]
irb[0x806b95e]
irb(rb_yield+0x21)[0x806cdc1]
irb(rb_ary_each+0x31)[0x80d1c51]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x8060e11]
irb[0x80618ce]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x806d630]
irb(ruby_exec+0x16)[0x806d656]
irb(ruby_run+0x21)[0x806d9a1]
irb[0x805527f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb759b450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08103000-081f8000 rw-p 08103000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b7471000-b749e000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b749e000-b74a1000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b74a1000-b74cd000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b74cd000-b74d1000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b74d1000-b74d2000 rw-p b74d1000 00:00 0 
b74e2000-b756d000 rw-p b74e2000 00:00 0 
b756d000-b7581000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7581000-b7583000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7583000-b7585000 rw-p b7583000 00:00 0 
b7585000-b76ce000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76ce000-b76cf000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76cf000-b76d1000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76d1000-b76d4000 rw-p b76d1000 00:00 0 
b76d4000-b76f7000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76f7000-b76f9000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76f9000-b7702000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7702000-b7704000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7704000-b772c000 rw-p b7704000 00:00 0 
b772c000-b772e000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b772e000-b7730000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b7730000-b7737000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7737000-b7739000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7739000-b7743000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b7743000-b7744000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b7744000-b7748000 r-xp 00000000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7748000-b7749000 rw-p 00003000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7749000-b774b000 rw-p b7749000 00:00 0 
b774b000-b774c000 r-xp b774b000 00:00 0          [vdso]
b774c000-b7766000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b7766000-b7768000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfe33000-bfe48000 rw-p bffeb000 00:00 0          [stack]
Aborted
echo "li = LineItem.find(:all, :params => {:order_id=>1}).first\\nputs li.total_price\\nli.total_price*=0.8\\nli.save\\nli2 = LineItem.new(:order_id=>1, :product_id=>2, :quantity=>1, :total_price=>0.0)\\nli2.save" | IRBRC=tmp/irbrc ruby script/console
*** glibc detected *** irb: realloc(): invalid next size: 0x081e52d0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7643803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb764575b]
irb(ruby_xrealloc+0x56)[0x8075696]
irb(rb_str_resize+0x53)[0x80bfcc3]
irb[0x80721c7]
irb(rb_find_file_ext+0x1d2)[0x8072a32]
irb(rb_require_safe+0x12d)[0x806726d]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x8067be6]
irb[0x806806b]
irb[0x8059334]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ecf3]
irb[0x805ef39]
irb[0x806b95e]
irb(rb_yield+0x21)[0x806cdc1]
irb(rb_ary_each+0x31)[0x80d1c51]
irb[0x8063ab6]
irb[0x8063d81]
irb[0x8060e11]
irb[0x80618ce]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x80639fc]
irb[0x8063d81]
irb[0x805ebc6]
irb[0x806d630]
irb(ruby_exec+0x16)[0x806d656]
irb(ruby_run+0x21)[0x806d9a1]
irb[0x805527f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb75ec450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 20446      /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/bin/ruby
08103000-081f8000 rw-p 08103000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b74c2000-b74ef000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b74ef000-b74f2000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b74f2000-b751e000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b751e000-b7522000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b7522000-b7523000 rw-p b7522000 00:00 0 
b7533000-b75be000 rw-p b7533000 00:00 0 
b75be000-b75d2000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75d2000-b75d4000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75d4000-b75d6000 rw-p b75d4000 00:00 0 
b75d6000-b771f000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b771f000-b7720000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b7720000-b7722000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b7722000-b7725000 rw-p b7722000 00:00 0 
b7725000-b7748000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7748000-b774a000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b774a000-b7753000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7753000-b7755000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7755000-b777d000 rw-p b7755000 00:00 0 
b777d000-b777f000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b777f000-b7781000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b7781000-b7788000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7788000-b778a000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b778a000-b7794000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b7794000-b7795000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b7795000-b7799000 r-xp 00000000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b7799000-b779a000 rw-p 00003000 08:05 8703887    /home/rubys/.rvm/rubies/ruby-1.8.8-r27984/lib/ruby/1.8/i686-linux/readline.so
b779a000-b779c000 rw-p b779a000 00:00 0 
b779c000-b779d000 r-xp b779c000 00:00 0          [vdso]
b779d000-b77b7000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b77b7000-b77b9000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfb9f000-bfbb4000 rw-p bffeb000 00:00 0          [stack]
Aborted

Table of Contents 25.1 Sending E-mail