Fixes #142 with dynamic ActionMailer url options
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
before_filter :authenticated, :has_info, :create_analytic
|
before_filter :authenticated, :has_info, :create_analytic, :mailer_options
|
||||||
helper_method :current_user, :is_admin?, :sanitize_font
|
helper_method :current_user, :is_admin?, :sanitize_font
|
||||||
|
|
||||||
# Our security guy keep talking about sea-surfing, cool story bro.
|
# Our security guy keep talking about sea-surfing, cool story bro.
|
||||||
@@ -7,6 +7,11 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def mailer_options
|
||||||
|
ActionMailer::Base.default_url_options[:protocol] = request.protocol
|
||||||
|
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||||
|
end
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
@current_user ||= (
|
@current_user ||= (
|
||||||
User.find_by_auth_token(cookies[:auth_token].to_s) ||
|
User.find_by_auth_token(cookies[:auth_token].to_s) ||
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Railsgoat::Application.configure do
|
|||||||
# Log the query plan for queries taking more than this (works
|
# Log the query plan for queries taking more than this (works
|
||||||
# with SQLite, MySQL, and PostgreSQL)
|
# with SQLite, MySQL, and PostgreSQL)
|
||||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||||
|
|
||||||
# Tired of caching causing issues
|
# Tired of caching causing issues
|
||||||
config.middleware.delete Rack::ETag
|
config.middleware.delete Rack::ETag
|
||||||
|
|
||||||
@@ -41,7 +41,6 @@ Railsgoat::Application.configure do
|
|||||||
# ActionMailer settings for email support
|
# ActionMailer settings for email support
|
||||||
config.action_mailer.delivery_method = :smtp
|
config.action_mailer.delivery_method = :smtp
|
||||||
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
|
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
|
||||||
config.action_mailer.default_url_options = { :host => "localhost:3000" }
|
|
||||||
|
|
||||||
config.middleware.insert_before(
|
config.middleware.insert_before(
|
||||||
Rack::Lock, Rack::LiveReload,
|
Rack::Lock, Rack::LiveReload,
|
||||||
|
|||||||
Reference in New Issue
Block a user