Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't assume ActionMailer is available #608

Merged
merged 1 commit into from
Nov 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/helpers/react_on_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def initialize_redux_stores
def rails_context(server_side:)
@rails_context ||= begin
result = {
inMailer: controller.present? && controller.is_a?(ActionMailer::Base),
inMailer: in_mailer?,
# Locale settings
i18nLocale: I18n.locale,
i18nDefaultLocale: I18n.default_locale
Expand Down Expand Up @@ -400,4 +400,11 @@ def send_tag_method(tag_method_name, args)
options = args.delete_if { |key, _value| %i(hot static).include?(key) }
send(tag_method_name, *assets, options) unless assets.empty?
end

def in_mailer?
return false unless controller.present?
return false unless defined?(ActionMailer::Base)

controller.is_a?(ActionMailer::Base)
end
end