public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Add example for default_url_options[:host] to generated mailers.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
mislav (author)
Fri Apr 18 15:19:28 -0700 2008
josh (committer)
Fri Apr 18 15:19:28 -0700 2008
commit  69a5c1df8293fc8de2cec0fc9fa18181cb9ad469
tree    f35567f2744c7e36a734d544818cbafc06d6c52e
parent  29ea0f68aa515f29fe440dabf6d40807e348b703
...
1
 
 
 
2
3
4
5
...
7
8
9
10
 
11
12
 
13
...
1
2
3
4
5
6
7
8
...
10
11
12
 
13
14
15
16
17
0
@@ -1,4 +1,7 @@
0
 class <%= class_name %> < ActionMailer::Base
0
+
0
+ # change to your domain name
0
+ default_url_options[:host] = 'example.com'
0
 <% for action in actions -%>
0
 
0
   def <%= action %>(sent_at = Time.now)
0
0
@@ -7,8 +10,9 @@
0
     from ''
0
     sent_on sent_at
0
     
0
- body :action => '<%= action %>'
0
+ body :greeting => 'Hi,'
0
   end
0
 <% end -%>
0
+
0
 end
...
13
14
15
16
 
17
18
19
 
 
 
20
21
22
...
13
14
15
 
16
17
18
19
20
21
22
23
24
25
0
@@ -13,10 +13,13 @@
0
             "from ''",
0
             "sent_on sent_at",
0
             "",
0
- "body :action => 'reset_password'"
0
+ "body :greeting => 'Hi,'"
0
           ],
0
           body.split("\n").map{|line| line.sub(' '*4, '') }
0
       end
0
+
0
+ assert_match /^ default_url_options\[:host\] = 'example.com'$/m, model,
0
+ 'model should include default_url_options :host declaration'
0
     end
0
     
0
     assert_generated_views_for :notifier, 'reset_password.erb'

Comments

  • lgn21st Fri Apr 18 20:08:46 -0700 2008

    Could have a way to autodetect the domain name?
    This is my real problem…

  • josh Fri Apr 18 21:47:49 -0700 2008

    default_url_options is really nasty. Nice auto detection would be great. PID :)