26.1 Active Merchant 25.1 rack
implement a custom rake task
edit lib/tasks/db_backup.rake
namespace :db do
desc "Backup the production database"
task :backup => :environment do
backup_dir = ENV['DIR'] || File.join(Rails.root, 'db', 'backup')
source = File.join(Rails.root, 'db', "production.db")
dest = File.join(backup_dir, "production.backup")
makedirs backup_dir, :verbose => true
require 'shellwords'
sh "sqlite3 #{Shellwords.escape source} .dump > #{Shellwords.escape dest}"
end
end
rake db:backup
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from rescue in <class:Exception> at /home/rubys/.rvm/gems/ruby-head-n50123/gems/web-console-2.1.2/lib/web_console/integration/cruby.rb:37)
mkdir -p /home/rubys/git/awdwr/edition4/work-220/depot/db/backup
sqlite3 /home/rubys/git/awdwr/edition4/work-220/depot/db/production.db .dump > /home/rubys/git/awdwr/edition4/work-220/depot/db/backup/production.backup
cleanup (for HAML)
edit app/views/store/index.html.erb
remove scaffolding needed for standalone operation
edit app/store.rb
class StoreApp
def call(env)
x = Builder::XmlMarkup.new :indent=>2
x.declare! :DOCTYPE, :html
x.html do
x.head do
x.title 'Pragmatic Bookshelf'
end
x.body do
x.h1 'Pragmatic Bookshelf'
Product.all.each do |product|
x.h2 product.title
x << " #{product.description}\n"
x.p product.price
end
end
end
response = Rack::Response.new(x.target!)
response['Content-Type'] = 'text/html'
response.finish
end
end