Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

inquriy_mailer.rb refactored in order to remove duplication #129

Closed
wants to merge 1 commit into from

2 participants

@darmens

No description provided.

@ugisozols
Owner

There's already similar PR - #120.

@darmens

I missed it. Good.

@ugisozols ugisozols closed this
@ugisozols
Owner

I merged #120. Thanks for sending PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 9 deletions.
  1. +12 −9 app/mailers/refinery/inquiries/inquiry_mailer.rb
View
21 app/mailers/refinery/inquiries/inquiry_mailer.rb
@@ -6,10 +6,7 @@ def confirmation(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
:to => inquiry.email,
- :from => ::I18n.t('from_name',
- :scope => 'refinery.inquiries.config',
- :site_name => Refinery::Core.site_name,
- :name => @inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>",
+ :from => from_field_for(@inquiry, request),
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
end
@@ -17,13 +14,19 @@ def notification(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.notification_subject,
:to => Refinery::Inquiries::Setting.notification_recipients,
- :from => ::I18n.t('from_name',
- :scope => 'refinery.inquiries.config',
- :site_name => Refinery::Core.site_name,
- :name => @inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>",
+ :from => from_field_for(@inquiry, request),
:reply_to => inquiry.email
end
-
+
+ private
+
+ def from_field_for(inquiry, request)
+ ::I18n.t('from_name',
+ :scope => 'refinery.inquiries.config',
+ :site_name => Refinery::Core.site_name,
+ :name => inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>"
+ end
+
end
end
end
Something went wrong with that request. Please try again.