diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-04-06 13:01:12 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-04-06 13:01:12 +0530 |
commit | c327ef4d65650743fbf49c8ba29016ecef70dd39 (patch) | |
tree | 8cf71d7adb7fe60ed537b3783bbd8d5ca19fab67 | |
parent | 4ac719686c0075b6ad6896becfe0f058efdb97ff (diff) | |
parent | 92e6255b58ce445d23580b669dac67d80e64d411 (diff) | |
download | rails-c327ef4d65650743fbf49c8ba29016ecef70dd39.tar.gz rails-c327ef4d65650743fbf49c8ba29016ecef70dd39.tar.bz2 rails-c327ef4d65650743fbf49c8ba29016ecef70dd39.zip |
Merge branch 'master' of github.com:lifo/docrails
-rw-r--r-- | actionmailer/README.rdoc | 13 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 14d20bb08d..9b206fbcc7 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -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/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 65b002ebad..de75488e72 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -81,9 +81,12 @@ module ActionView # # => /workshops # # <%= url_for(@workshop) %> - # # calls @workshop.to_s + # # calls @workshop.to_param which by default returns the id # # => /workshops/5 # + # # to_param can be re-defined in a model to provide different URL names: + # # => /workshops/1-workshop-name + # # <%= url_for("http://www.example.com") %> # # => http://www.example.com # |