Hi all,
In our current project we are managing a multi-domain Rails app and we
sometimes need the views to specialize depending on the domain that is
running. We used to use a separate view path that we prepended to achieve
that and since the release of Rails 4.1 we started using variants for that
purpose.
However, it seems variants are not supported for ActionMailer. Since
AbstractController::Rendering only checks if request is defined and,
subsequently, if request.variant is present, we are currently hacking the
same behaviour by defining a request method on our Mailer like:
def request> @_request ||= OpenStruct.new(variant: domain)
> end
I guess the variant feature was originally implemented with content
negotiation in mind, but at least in our use case, it works beautifully for
alternative purposes as well. I am willing to add variants support for
ActionMailer, if there is any interest/willingness to do so.
Best,
Ufuk Kayserilioglu
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.