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-239/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[0xb7600803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb760275b]
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)[0xb75a9450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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 
b747f000-b74ac000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b74ac000-b74af000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b74af000-b74db000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b74db000-b74df000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b74df000-b74e0000 rw-p b74df000 00:00 0 
b74f0000-b757b000 rw-p b74f0000 00:00 0 
b757b000-b758f000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b758f000-b7591000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7591000-b7593000 rw-p b7591000 00:00 0 
b7593000-b76dc000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76dc000-b76dd000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76dd000-b76df000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b76df000-b76e2000 rw-p b76df000 00:00 0 
b76e2000-b7705000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7705000-b7707000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7707000-b7710000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7710000-b7712000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7712000-b773a000 rw-p b7712000 00:00 0 
b773a000-b773c000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b773c000-b773e000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b773e000-b7745000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7745000-b7747000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b7747000-b7751000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b7751000-b7752000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b7752000-b7756000 r-xp 00000000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b7756000-b7757000 rw-p 00003000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b7757000-b7759000 rw-p b7757000 00:00 0 
b7759000-b775a000 r-xp b7759000 00:00 0          [vdso]
b775a000-b7774000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b7774000-b7776000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfb01000-bfb16000 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[0xb766d803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb766f75b]
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)[0xb7616450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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 
b74ec000-b7519000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b7519000-b751c000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b751c000-b7548000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b7548000-b754c000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b754c000-b754d000 rw-p b754c000 00:00 0 
b755d000-b75e8000 rw-p b755d000 00:00 0 
b75e8000-b75fc000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75fc000-b75fe000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75fe000-b7600000 rw-p b75fe000 00:00 0 
b7600000-b7749000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b7749000-b774a000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b774a000-b774c000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b774c000-b774f000 rw-p b774c000 00:00 0 
b774f000-b7772000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7772000-b7774000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7774000-b777d000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b777d000-b777f000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b777f000-b77a7000 rw-p b777f000 00:00 0 
b77a7000-b77a9000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b77a9000-b77ab000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b77ab000-b77b2000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b77b2000-b77b4000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b77b4000-b77be000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b77be000-b77bf000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b77bf000-b77c3000 r-xp 00000000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b77c3000-b77c4000 rw-p 00003000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b77c4000-b77c6000 rw-p b77c4000 00:00 0 
b77c6000-b77c7000 r-xp b77c6000 00:00 0          [vdso]
b77c7000-b77e1000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b77e1000-b77e3000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfcf8000-bfd0d000 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: 0x081e52d0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb759e803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb75a075b]
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)[0xb7547450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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 
b741d000-b744a000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b744a000-b744d000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b744d000-b7479000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b7479000-b747d000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b747d000-b747e000 rw-p b747d000 00:00 0 
b748e000-b7519000 rw-p b748e000 00:00 0 
b7519000-b752d000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b752d000-b752f000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b752f000-b7531000 rw-p b752f000 00:00 0 
b7531000-b767a000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b767a000-b767b000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b767b000-b767d000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b767d000-b7680000 rw-p b767d000 00:00 0 
b7680000-b76a3000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76a3000-b76a5000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76a5000-b76ae000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76ae000-b76b0000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76b0000-b76d8000 rw-p b76b0000 00:00 0 
b76d8000-b76da000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b76da000-b76dc000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b76dc000-b76e3000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b76e3000-b76e5000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b76e5000-b76ef000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b76ef000-b76f0000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b76f0000-b76f4000 r-xp 00000000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b76f4000-b76f5000 rw-p 00003000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b76f5000-b76f7000 rw-p b76f5000 00:00 0 
b76f7000-b76f8000 r-xp b76f7000 00:00 0          [vdso]
b76f8000-b7712000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b7712000-b7714000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bf88b000-bf8a0000 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
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
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
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[0xb75a3803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb75a575b]
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)[0xb754c450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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 
b7422000-b744f000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b744f000-b7452000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b7452000-b747e000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b747e000-b7482000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b7482000-b7483000 rw-p b7482000 00:00 0 
b7493000-b751e000 rw-p b7493000 00:00 0 
b751e000-b7532000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7532000-b7534000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b7534000-b7536000 rw-p b7534000 00:00 0 
b7536000-b767f000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b767f000-b7680000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b7680000-b7682000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b7682000-b7685000 rw-p b7682000 00:00 0 
b7685000-b76a8000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76a8000-b76aa000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b76aa000-b76b3000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76b3000-b76b5000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b76b5000-b76dd000 rw-p b76b5000 00:00 0 
b76dd000-b76df000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b76df000-b76e1000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b76e1000-b76e8000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b76e8000-b76ea000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b76ea000-b76f4000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b76f4000-b76f5000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b76f5000-b76f9000 r-xp 00000000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b76f9000-b76fa000 rw-p 00003000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b76fa000-b76fc000 rw-p b76fa000 00:00 0 
b76fc000-b76fd000 r-xp b76fc000 00:00 0          [vdso]
b76fd000-b7717000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b7717000-b7719000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bf95e000-bf973000 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
Please Log In
post /admin/login
You are being redirected.
get http://localhost:3000/admin

Welcome

It's Sun Jun 06 06:20:55 -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-06-06T10:12:35Z</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-06-06T10:12:35Z</updated-at>
  </line-item>
  <line-item>
    <created-at type="datetime">2010-06-06T10:14:00Z</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-06-06T10:14:00Z</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: 0x081e52d0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7661803]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb766375b]
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)[0xb760a450]
irb[0x80551d1]
======= Memory map: ========
08048000-08102000 r-xp 00000000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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 
b74e0000-b750d000 r-xp 00000000 08:05 2965573    /lib/libncurses.so.5.6
b750d000-b7510000 rw-p 0002c000 08:05 2965573    /lib/libncurses.so.5.6
b7510000-b753c000 r-xp 00000000 08:05 2965623    /lib/libreadline.so.5.2
b753c000-b7540000 rw-p 0002c000 08:05 2965623    /lib/libreadline.so.5.2
b7540000-b7541000 rw-p b7540000 00:00 0 
b7551000-b75dc000 rw-p b7551000 00:00 0 
b75dc000-b75f0000 r-xp 00000000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75f0000-b75f2000 rw-p 00013000 08:05 2998328    /lib/tls/i686/cmov/libpthread-2.7.so
b75f2000-b75f4000 rw-p b75f2000 00:00 0 
b75f4000-b773d000 r-xp 00000000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b773d000-b773e000 r--p 00149000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b773e000-b7740000 rw-p 0014a000 08:05 2998314    /lib/tls/i686/cmov/libc-2.7.so
b7740000-b7743000 rw-p b7740000 00:00 0 
b7743000-b7766000 r-xp 00000000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7766000-b7768000 rw-p 00023000 08:05 2998318    /lib/tls/i686/cmov/libm-2.7.so
b7768000-b7771000 r-xp 00000000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7771000-b7773000 rw-p 00008000 08:05 2998316    /lib/tls/i686/cmov/libcrypt-2.7.so
b7773000-b779b000 rw-p b7773000 00:00 0 
b779b000-b779d000 r-xp 00000000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b779d000-b779f000 rw-p 00001000 08:05 2998317    /lib/tls/i686/cmov/libdl-2.7.so
b779f000-b77a6000 r-xp 00000000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b77a6000-b77a8000 rw-p 00006000 08:05 2998330    /lib/tls/i686/cmov/librt-2.7.so
b77a8000-b77b2000 r-xp 00000000 08:05 2969156    /lib/libgcc_s.so.1
b77b2000-b77b3000 rw-p 0000a000 08:05 2969156    /lib/libgcc_s.so.1
b77b3000-b77b7000 r-xp 00000000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b77b7000-b77b8000 rw-p 00003000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b77b8000-b77ba000 rw-p b77b8000 00:00 0 
b77ba000-b77bb000 r-xp b77ba000 00:00 0          [vdso]
b77bb000-b77d5000 r-xp 00000000 08:05 1786011    /lib/ld-2.7.so
b77d5000-b77d7000 rw-p 00019000 08:05 1786011    /lib/ld-2.7.so
bfee4000-bfef9000 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 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/bin/ruby
08102000-08103000 rw-p 000ba000 08:05 754237     /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/lib/ruby/1.8/i686-linux/readline.so
b7799000-b779a000 rw-p 00003000 08:05 1098477    /home/rubys/.rvm/rubies/ruby-1.8.8-r28169/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
bf7ed000-bf802000 rw-p bffeb000 00:00 0          [stack]
Aborted

Table of Contents 25.1 Sending E-mail