From c15d3fb0da9e90850a79dc64ebd6614618e35fec Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 30 Nov 2014 10:18:07 +0900 Subject: [ci skip] fix description of url_for --- actionmailer/lib/action_mailer/base.rb | 5 ----- guides/source/action_mailer_basics.md | 14 +------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index a88e884ee8..67e316c4fe 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -132,11 +132,6 @@ module ActionMailer # # config.action_mailer.default_url_options = { host: "example.com" } # - # When you decide to set a default :host for your mailers, then you need to make sure to use the - # only_path: false option when using url_for. Since the url_for view helper - # will generate relative URLs by default when a :host option isn't explicitly provided, passing - # only_path: false will ensure that absolute URLs are generated. - # # = Sending mail # # Once a mailer action and template are defined, you can deliver your message or create it and save it diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index 2e8ab83241..ba7c16aa1d 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -470,16 +470,7 @@ By using the full URL, your links will now work in your emails. #### generating URLs with `url_for` -You need to pass the `only_path: false` option when using `url_for`. This will -ensure that absolute URLs are generated because the `url_for` view helper will, -by default, generate relative URLs when a `:host` option isn't explicitly -provided. - -```erb -<%= url_for(controller: 'welcome', - action: 'greeting', - only_path: false) %> -``` +`url_for` generate full URL by default in templates. If you did not configure the `:host` option globally make sure to pass it to `url_for`. @@ -491,9 +482,6 @@ If you did not configure the `:host` option globally make sure to pass it to action: 'greeting') %> ``` -NOTE: When you explicitly pass the `:host` Rails will always generate absolute -URLs, so there is no need to pass `only_path: false`. - #### generating URLs with named routes Email clients have no web context and so paths have no base URL to form complete -- cgit v1.2.3