26 Active Resources 23.11 Adding New Templating Systems
bundle exec /home/rubys/git/rails/bin/rails new mailer --skip-bundle --dev
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/application.js
create public/javascripts/controls.js
create public/javascripts/dragdrop.js
create public/javascripts/effects.js
create public/javascripts/prototype.js
create public/javascripts/rails.js
create script
create script/rails
create test
create test/fixtures
create test/functional
create test/integration
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep
bundle install
Using rake (0.9.2.2)
Using abstract (1.0.0)
Using activesupport (3.0.15)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.15)
Using erubis (2.6.6)
Using rack (1.2.5)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.33)
Using actionpack (3.0.15)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.15)
Using braintree (2.16.0)
Using activemerchant (1.10.0)
Using arel (2.0.10)
Using activerecord (3.0.15)
Using activeresource (3.0.15)
Using bundler (1.1.3)
Using highline (1.6.13)
Using net-ssh (2.5.2)
Using net-scp (1.0.4)
Using net-sftp (2.0.5)
Using net-ssh-gateway (1.1.0)
Using capistrano (2.12.0)
Using haml (3.1.6)
Using htmlentities (4.3.1)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.0.15)
Using rails (3.0.15)
Using jquery-rails (0.2.7)
Using minitest (3.2.0)
Using mysql (2.8.1)
Using sqlite3 (1.3.6)
Using test-unit (2.5.0)
Using will_paginate (3.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
edit config/routes.rb
Mailer::Application.routes.draw do
# ...
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
match ':controller(/:action(/:id(.:format)))'
end
rails generate mailer OrderMailer confirm sent
create app/mailers/order_mailer.rb
invoke erb
create app/views/order_mailer
create app/views/order_mailer/confirm.text.erb
create app/views/order_mailer/sent.text.erb
invoke test_unit
create test/functional/order_mailer_test.rb
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/mailer/db/migrate db
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/db/migrate' -> `db/migrate'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/db/migrate/004_populate_data.rb' -> `db/migrate/004_populate_data.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/db/migrate/003_create_orders.rb' -> `db/migrate/003_create_orders.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/db/migrate/002_create_line_items.rb' -> `db/migrate/002_create_line_items.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/db/migrate/001_create_products.rb' -> `db/migrate/001_create_products.rb'
cp -v /home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/controllers/* app/controllers
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/controllers/application.rb' -> `app/controllers/application.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/controllers/order_controller.rb' -> `app/controllers/order_controller.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/controllers/test_controller.rb' -> `app/controllers/test_controller.rb'
cp -v /home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/models/* app/models
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/models/incoming_ticket_handler.rb' -> `app/models/incoming_ticket_handler.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/models/line_item.rb' -> `app/models/line_item.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/models/order.rb' -> `app/models/order.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/models/order_mailer.rb' -> `app/models/order_mailer.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/models/product.rb' -> `app/models/product.rb'
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/mailer/test .
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/fixtures/orders.yml' -> `./test/fixtures/orders.yml'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/fixtures/order_mailer' -> `./test/fixtures/order_mailer'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/fixtures/order_mailer/confirm' -> `./test/fixtures/order_mailer/confirm'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/fixtures/order_mailer/sent' -> `./test/fixtures/order_mailer/sent'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/fixtures/line_items.yml' -> `./test/fixtures/line_items.yml'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/fixtures/products.yml' -> `./test/fixtures/products.yml'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/functional/order_controller_test.rb' -> `./test/functional/order_controller_test.rb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/test/functional/order_mailer_test.rb' -> `./test/functional/order_mailer_test.rb'
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer app/views
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer/confirm.erb' -> `app/views/order_mailer/confirm.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer/survey.text.plain.erb' -> `app/views/order_mailer/survey.text.plain.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer/sent.erb' -> `app/views/order_mailer/sent.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer/_line_item.erb' -> `app/views/order_mailer/_line_item.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer/_html_line_item.erb' -> `app/views/order_mailer/_html_line_item.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/mailer/app/views/order_mailer/survey.text.html.erb' -> `app/views/order_mailer/survey.text.html.erb'
mv app/models/order_mailer.rb app/mailers/
mv confirm.erb confirm.text.erb
mv _line_item.erb _line_item.text.erb
mv sent.erb sent.html.erb
edit sent.html.erb
<h3>Pragmatic Order Shipped</h3>
<p>
This is just to let you know that we've shipped your recent order:
</p>
<table>
<tr><th colspan="2">Qty</th><th>Description</th></tr>
<%= render(:partial => "line_item", :collection => @order.line_items) %>
</table>
mv _html_line_item.erb _line_item.html.erb
edit _line_item.html.erb
<tr>
<td><%= line_item.quantity %></td>
<td>×</td>
<td><%= line_item.product.title %></td>
</tr>
rm sent.text.erb
rake db:migrate
mv 001_create_products.rb 20110711000001_create_products.rb
mv 002_create_line_items.rb 20110711000002_create_line_items.rb
mv 003_create_orders.rb 20110711000003_create_orders.rb
mv 004_populate_data.rb 20110711000004_populate_data.rb
== CreateProducts: migrating =================================================
-- create_table(:products)
-> 0.0033s
== CreateProducts: migrated (0.0035s) ========================================
== CreateLineItems: migrating ================================================
-- create_table(:line_items)
-> 0.0026s
== CreateLineItems: migrated (0.0028s) =======================================
== CreateOrders: migrating ===================================================
-- create_table(:orders)
-> 0.0029s
== CreateOrders: migrated (0.0032s) ==========================================
== PopulateData: migrating ===================================================
== PopulateData: migrated (0.1888s) ==========================================
get /test/create_order
Date: Fri, 29 Jun 2012 15:24:46 -0400 From: orders@example.com To: dave@example.com Message-ID: <4fee00ff2a5a1_203b3f87668a99f469419@rubix.mail> Subject: Pragmatic Store Order Confirmation Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Dear Dave Thomas Thank you for your recent order from The Pragmatic Store. You ordered the following items: 1 x Programming Ruby, 2nd Edition 1 x Pragmatic Project Automation We'll send you a separate e-mail when your order ships.
get /test/ship_order
rake test
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/rake_test_loader
DEPRECATION WARNING: OrderMailer.deliver_confirm is deprecated, use OrderMailer.confirm.deliver instead. (called from confirm at /home/rubys/git/awdwr/edition3/work-30/mailer/app/controllers/order_controller.rb:4)
DEPRECATION WARNING: Giving a hash to body is deprecated, please use instance variables instead. (called from process at /home/rubys/git/rails/actionmailer/lib/action_mailer/old_api.rb:77)
DEPRECATION WARNING: OrderMailer.create_confirm is deprecated, use OrderMailer.confirm instead. (called from test_confirm at /home/rubys/git/awdwr/edition3/work-30/mailer/test/functional/order_mailer_test.rb:13)
DEPRECATION WARNING: Giving a hash to body is deprecated, please use instance variables instead. (called from process at /home/rubys/git/rails/actionmailer/lib/action_mailer/old_api.rb:77)
DEPRECATION WARNING: OrderMailer.create_sent is deprecated, use OrderMailer.sent instead. (called from test_sent at /home/rubys/git/awdwr/edition3/work-30/mailer/test/functional/order_mailer_test.rb:27)
DEPRECATION WARNING: Giving a hash to body is deprecated, please use instance variables instead. (called from process at /home/rubys/git/rails/actionmailer/lib/action_mailer/old_api.rb:77)
Started
Finished in 0.509108 seconds.
3 tests, 9 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
5.89 tests/s, 17.68 assertions/s