diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2011-04-05 21:22:38 +1000 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2011-04-05 21:22:38 +1000 |
commit | 92e6255b58ce445d23580b669dac67d80e64d411 (patch) | |
tree | de3a01091787b30f1bafd462eedcb6210342493a /actionmailer | |
parent | 357578256fb55e32ae87c6fbf22a1c19f59ce264 (diff) | |
parent | ac07da8fc72b7a57fd4a60c0dcb5b777d85f9eb7 (diff) | |
download | rails-92e6255b58ce445d23580b669dac67d80e64d411.tar.gz rails-92e6255b58ce445d23580b669dac67d80e64d411.tar.bz2 rails-92e6255b58ce445d23580b669dac67d80e64d411.zip |
Merge branch 'master' of github.com:lifo/docrails
* 'master' of github.com:lifo/docrails: (57 commits)
Made the defaults section a little more readable and more to the point, giving a overview of the possibilities.
Added information about default values
added .'s to headings in the initialization textile page
s/ERb/ERB/g (part II)
s/ERb/ERB/g
Bump up erubis to 2.7.0
Implicit actions named not_implemented can be rendered
Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0
default_executable is deprecated since rubygems 1.7.0
Trivial fix to HTTP Digest auth MD5 example
Moved Turn activation/dependency to railties
fix typo
Direct logging of Active Record to STDOUT so it's shown inline with the results in the console [DHH]
Add using Turn with natural language test case names if the library is available (which it will be in Rails 3.1) [DHH]
require turn only for minitest
Use Turn to format all Rails tests and enable the natural language case names
Improve docs.
pass respond_with options to controller render when using a template for api navigation
only try to display an api template in responders if the request is a get or there are no errors
when using respond_with with an invalid resource and custom options, the default response status and error messages should be returned
...
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/README.rdoc | 15 | ||||
-rw-r--r-- | actionmailer/actionmailer.gemspec | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 0fa18d751b..9b206fbcc7 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -32,7 +32,7 @@ This can be as simple as: end The body of the email is created by using an Action View template (regular -ERb) that has the instance variables that are declared in the mailer action. +ERB) that has the instance variables that are declared in the mailer action. So the corresponding body template for the method above could look like this: @@ -72,6 +72,19 @@ Or you can just chain the methods together like: Notifier.welcome.deliver # Creates the email and sends it immediately +== Setting defaults + +It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you wont need to worry about that. Finally it is also possible to pass in a Proc that will get evaluated when it is needed. + +Note that every value you set with this method will get over written if you use the same key in your mailer method. + +Example: + + class Authenticationmailer < ActionMailer::Base + default :from => "awesome@application.com", :subject => Proc.new { "E-mail was generated at #{Time.now}" } + ..... + end + == Receiving emails To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes an diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index 2ae85f8b57..ee02cf6945 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -17,8 +17,6 @@ Gem::Specification.new do |s| s.require_path = 'lib' s.requirements << 'none' - s.has_rdoc = true - s.add_dependency('actionpack', version) s.add_dependency('mail', '~> 2.2.15') end |