aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-09-02 19:32:45 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-09-02 19:32:45 +0000
commit20bd4bd3e2bff716acdf48bba1b97a1afdcd088d (patch)
tree8b2432b15350437dc5e9c42e83bd6fbbd97a7b4a /actionmailer/lib
parentbf2bddd29fca60754d6aba60b55d109f5b78fb48 (diff)
downloadrails-20bd4bd3e2bff716acdf48bba1b97a1afdcd088d.tar.gz
rails-20bd4bd3e2bff716acdf48bba1b97a1afdcd088d.tar.bz2
rails-20bd4bd3e2bff716acdf48bba1b97a1afdcd088d.zip
Updated docs and otherwise
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4902 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/lib')
-rwxr-xr-xactionmailer/lib/action_mailer.rb2
-rw-r--r--actionmailer/lib/action_mailer/base.rb44
-rw-r--r--actionmailer/lib/action_mailer/version.rb2
3 files changed, 41 insertions, 7 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 894bc824ee..c702a06dc7 100755
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -27,7 +27,7 @@ unless defined?(ActionController)
require 'action_controller'
rescue LoadError
require 'rubygems'
- require_gem 'actionpack', '>= 1.9.1'
+ require_gem 'actionpack', '>= 1.12.5'
end
end
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 7045fddb1b..00b02c746e 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -7,7 +7,9 @@ require 'tmail/net'
module ActionMailer #:nodoc:
# ActionMailer allows you to send email from your application using a mailer model and views.
#
+ #
# = Mailer Models
+ #
# To use ActionMailer, you need to create a mailer model.
#
# $ script/generate mailer Notifier
@@ -23,7 +25,7 @@ module ActionMailer #:nodoc:
# recipients recipient.email_address_with_name
# from "system@example.com"
# subject "New account information"
- # body "account" => recipient
+ # body :account => recipient
# end
# end
#
@@ -45,7 +47,9 @@ module ActionMailer #:nodoc:
# in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
# view.
#
- # = Mailer Views
+ #
+ # = Mailer views
+ #
# Like ActionController, each mailer class has a corresponding view directory
# in which each method of the class looks for a template with its name.
# To define a template to be used with a mailing, create an <tt>.rhtml</tt> file with the same name as the method
@@ -59,7 +63,30 @@ module ActionMailer #:nodoc:
# Hi <%= @account.name %>,
# Thanks for joining our service! Please check back often.
#
- # = Sending Mail
+ # You can even use Action Pack helpers in these views. For example:
+ #
+ # You got a new note!
+ # <%= truncate(note.body, 25) %>
+ #
+ #
+ # = Generating URLs for mailer views
+ #
+ # If your view includes URLs from the application, you need to use url_for in the mailing method instead of the view.
+ # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request. That's
+ # why you need to jump this little hoop and supply all the details needed for the URL. Example:
+ #
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # from "system@example.com"
+ # subject "New account information"
+ # body :account => recipient,
+ # :home_page => url_for(:host => "example.com", :controller => "welcome", :action => "greeting")
+ # end
+ #
+ # You can now access @home_page in the template and get http://example.com/welcome/greeting.
+ #
+ # = Sending mail
+ #
# Once a mailer action and template are defined, you can deliver your message or create it and save it
# for delivery later:
#
@@ -73,7 +100,9 @@ module ActionMailer #:nodoc:
# like to deliver. The <tt>signup_notification</tt> method defined above is
# delivered by invoking <tt>Notifier.deliver_signup_notification</tt>.
#
- # = HTML Email
+ #
+ # = HTML email
+ #
# To send mail as HTML, make sure your view (the <tt>.rhtml</tt> file) generates HTML and
# set the content type to html.
#
@@ -87,7 +116,9 @@ module ActionMailer #:nodoc:
# end
# end
#
- # = Multipart Email
+ #
+ # = Multipart email
+ #
# You can explicitly specify multipart messages:
#
# class ApplicationMailer < ActionMailer::Base
@@ -120,7 +151,9 @@ module ActionMailer #:nodoc:
# with the corresponding content type. The same body hash is passed to
# each template.
#
+ #
# = Attachments
+ #
# Attachments can be added by using the +attachment+ method.
#
# Example:
@@ -141,6 +174,7 @@ module ActionMailer #:nodoc:
# end
# end
#
+ #
# = Configuration options
#
# These options are specified on the class level, like <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
diff --git a/actionmailer/lib/action_mailer/version.rb b/actionmailer/lib/action_mailer/version.rb
index ba6a301cf9..21bc3f6a92 100644
--- a/actionmailer/lib/action_mailer/version.rb
+++ b/actionmailer/lib/action_mailer/version.rb
@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 1
MINOR = 2
- TINY = 1
+ TINY = 5
STRING = [MAJOR, MINOR, TINY].join('.')
end