Rails 3 DRY Conditional Layout for iframes
问题 I was recently tasked with loading a portion of my Rails application within an iframe on another website. The relevant pages should be using a different layout file, but only if they're being rendered inside of the iframe. There was a solution proposed here Detect iframe request in a rails app that involved passing a query string parameter. For example the requesting website could call my application through an iframe with the src of http://foo.com/bar?iframe=true . Then in our controller we