Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Commit e2c172c

Browse files
committed
Merge pull request #1024 from YaleSTC/1017_request_email_links_master
resolves #1017
2 parents dbf437e + dac125e commit e2c172c

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Reservations ships with the default config time set to Eastern Time (US and Cana
9191
You will need to generate a fresh secret key for cookie encryption and signing. Run `rake secret` and paste the output into `config/intializers/secret_token.rb`. Do not make this key available to the public, otherwise anyone will be able to sign on as anyone to Reservations.
9292

9393
You will need to also configure the email config in
94-
`config/initializers/setup_mail.rb`. Replace `0.0.0.0:3000` with the
94+
`config/environments/production.rb`. Replace `example.com` with the
9595
relevant hostname. This will allow links in emails to point to the
9696
correct places.
9797

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<p>A new reservation request has been filed by
2-
<%= link_to @reservation.reserver.name, @reservation.reserver %></p>
2+
<%= link_to @reservation.reserver.name, user_url(@reservation.reserver, only_path: false) %></p>
33
<ul>
4-
<li>Equipment requested: <%= link_to @reservation.equipment_model.name, @reservation.equipment_model %> </li>
5-
<li>Requested start date: <%= @reservation.start_date.to_date.to_s(:long) %></li>
6-
<li>Requested end date: <%= @reservation.due_date.to_date.to_s(:long) %></li>
7-
<li>Notes: <%= @reservation.notes %></li>
4+
<li>Equipment requested: <%= link_to @reservation.equipment_model.name, equipment_model_url(@reservation.equipment_model, only_path: false) %> </li>
5+
<li>Requested start date: <%= @reservation.start_date.to_date.to_s(:long) %></li>
6+
<li>Requested end date: <%= @reservation.due_date.to_date.to_s(:long) %></li>
7+
<li>Notes: <%= @reservation.notes %></li>
88
</ul>
9-
<p>Click <%= link_to "here", review_request_path(@reservation) %> to review this request</p>
9+
<p>Click <%= link_to "here", review_request_url(@reservation, only_path: false) %> to review this request</p>
1010

config/environments/development.rb

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
# Use letter_opener for development mail testing
2323
config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener
24+
config.action_mailer.default_url_options = { host: "localhost:3000" }
2425

2526
# Print deprecation notices to the Rails logger
2627
config.active_support.deprecation = :log

config/environments/production.rb

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
# Enable threaded mode
4242
# config.threadsafe!
4343

44+
# mailer host: replace 'example.com' with your root url
45+
# this will allow links in email text to function correctly
46+
config.action_mailer.default_url_options = { host: "example.com" }
47+
4448
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
4549
# the I18n.default_locale when a translation can not be found)
4650
config.i18n.fallbacks = true

config/environments/test.rb

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# The :test delivery method accumulates sent emails in the
2626
# ActionMailer::Base.deliveries array.
2727
config.action_mailer.delivery_method = :test
28+
config.action_mailer.default_url_options = { host: "localhost:3000" }
2829

2930
# Use SQL instead of Active Record's schema dumper when creating the test database.
3031
# This is necessary if your schema can't be completely dumped by the schema dumper,

config/initializers/setup_mail.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,4 @@
1010
#:password => "password",
1111
:enable_starttls_auto => true
1212

13-
}
14-
15-
# mailer host: replace "0.0.0.0:3000" with your root url in production
16-
# this will allow links in e-mail text to function correctly
17-
ActionMailer::Base.default_url_options[:host] = "0.0.0.0:3000"
13+
}

0 commit comments

Comments
 (0)