Forum: Ruby on Rails Why are JS requests using layouts?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
328f0bb678423fcea01ebe3b0edc74e6?d=identicon&s=25 Ben Johnson (benjohnson)
on 2008-12-31 20:18
If I specify a layout in a controller:

class MyController < ApplicationController
layout "some_layout"

Any JS request will use the some_layout. I thought certain requests
types were exempt from layouts? When I remove the layout call everything
works perfect, the problem is that it uses the application layout.

Any ideas why this is or how I can fix this?

C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2009-01-02 12:23
(Received via mailing list)
Ben Johnson wrote:
> Any ideas why this is or how I can fix this?
Is this with a recent version of Rails?
At one time you had to do

layout proc {|controller| 'some_layout' unless controller.request.xhr?}

But if you're doing proper RJS renders, I don't think it's now

Rails Wheels - Find Plugins, List & Sell Plugins -
This topic is locked and can not be replied to.