Thanks, Willc.
Controller code:
def show
@user = User::find_by_email(session["User.id"])
@uc = @user.user_collaborations.detect { |collaboration|
collaboration.collaboration_id == params[:id].to_i
}
if @uc
@collaboration = Collaboration.find(params[:id])
end
respond_to do |format|
format.html
format.xml
end
end
RXML:
This works fine:
xml.instruct!
xml.collaboration_record do
xml.timestamp(Time.now)
xml.user(:id => @user.id) do
xml.email(@user.email)
xml.firstname(@user.firstname)
xml.lastname(@user.lastname)
end
xml.collaboration(:id => @collaboration.id, :relationship => @uc.user_type) do
xml.collaboration_name(@collaboration.name)
xml.created_at @collaboration.created_at
xml.updated_at @collaboration.updated_at
xml.resources do
@collaboration.resources.each do |resource|
xml.resource(:id => resource.id) do
xml.name resource.name
xml.created_at resource.created_at
xml.updated_at resource.updated_at
xml.description resource.description
xml.filesize resource.filesize
xml.crc32 resource.filesize
xml.status resource.status
end
end
end
end
end
But this does not:
xml.instruct!
xml.collaboration_record do
xml.timestamp(Time.now)
xml.user(:id => @user.id) do
xml.email(@user.email)
xml.firstname(@user.firstname)
xml.lastname(@user.lastname)
end
xml.collaboration(:id => @collaboration.id, :relationship => @uc.user_type) do
xml.collaboration_name(@collaboration.name)
xml.created_at @collaboration.created_at
xml.updated_at @collaboration.updated_at
xml.resources do
render(:partial => "resource", :collection => @collaboration.resources)
end
end
end
With the above (non-working) file, here's _resource.rxml:
xml.resource(:id => resource.id) do
xml.name resource.name
xml.created_at resource.created_at
xml.updated_at resource.updated_at
xml.description resource.description
xml.filesize resource.filesize
xml.crc32 resource.filesize
xml.status resource.status
end
Similar code works fine when processing html requests.
As I mentioned, the logs seem to indicate that it's going straight to the .rhtml file and skipping the .rxml file entirely.