You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have an application that serves two different template sets depending on the URL it is called with. For this purpose I have (in config/initializers/mime_types.rb)
Mime::Type.register_alias "text/html", :iframe
and (in application_controller.rb)
before_filter :adjust_format
def adjust_format
request.format = :iframe if request.subdomains.first == "iframe" and request.format == :html
end
This works fine
with non-R_C controllers and no explicit "respond_to" block,
with R_C controllers and no explicit "wants.html" block,
with R_C controllers and a duplicated "wants.html" block as "wants.iframe".
But this is hardly DRY. How can I make R_C recognize the registered MIME type aliases, so that (in my case) it sees that the :iframe format is just an alias for :html, and uses the "wants.html" block but renders the :iframe template if "request.format==:iframe"?
Thank you!
The text was updated successfully, but these errors were encountered:
Update: it seems that just doubling the wants.html blocks as "wants.iframe" is not enough - then I get "TemplateMissing" exceptions, even when all templates are there.
Hello,
I have an application that serves two different template sets depending on the URL it is called with. For this purpose I have (in config/initializers/mime_types.rb)
and (in application_controller.rb)
This works fine
But this is hardly DRY. How can I make R_C recognize the registered MIME type aliases, so that (in my case) it sees that the :iframe format is just an alias for :html, and uses the "wants.html" block but renders the :iframe template if "request.format==:iframe"?
Thank you!
The text was updated successfully, but these errors were encountered: