Yes I have. I wrote a tiny app to illustrate my problem.
I have one model - user.rb:
class User < ActiveRecord::Base
class UsersController < ApplicationController
respond_to do |format|
render :xml => User.new, :layout => ‘application’
I defined routes for it: map.resources :users
Then I change this to vary rails’ versions for testing:
RAILS_GEM_VERSION = ‘2.2.2’ unless defined? RAILS_GEM_VERSION
Using :layout => ‘application’ or not doesn’t matter. When I hit
I get this output:
Processing UsersController#index to xml (for 127.0.0.1 at 2009-03-16
[4;36;1mSQL (0.3ms) [0;1mSET SQL_AUTO_IS_NULL=0
[4;35;1mUser Columns (1.5ms) SHOW FIELDS FROM
Rendering template within layouts/application
Completed in 34ms (View: 6, DB: 2) | 200 OK [http://localhost/
As you can see, it is renderin layouts/application.
I have defined views/layouts/application.xml.builder as such:
xml << yield
And what I get is:
What I expect to get is xml instruct on top,
then a response node, with user inside.
Any more insight will be greatly appreciated.
On Mar 4, 5:30 am, Heinz S. [email protected]