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
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
mkdir -p /home/rubys/git/awdwr/edition4/work-187-30/depot/db/backup
sqlite3 /home/rubys/git/awdwr/edition4/work-187-30/depot/db/production.db .dump > /home/rubys/git/awdwr/edition4/work-187-30/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