How do you trigger an xml response for "respond_to do |format|'

Hi - how do you trigger an xml response for "respond_to do |format|’ ?

Wondering why the following isn’t working for me (i.e. triggers HTML
response)

------------------view ----------------
<% remote_form_for :bi_allocation, @bi_allocation, :url => {
:controller
=> “bi_allocation”, :action => “r_create”} do |f| %>
<%= f.text_field :amount, :size => 10 %>
<%= submit_tag ‘Create’ %>
<% end %>

------------ controller ---------------------
def r_create
@bi_allocation = BiAllocation.new(params[:bi_allocation])
respond_to do |format|
if @bi_allocation.save
format.html raise("*** HITS THIS LINE ***")
format.xml { render :xml => @bi_allocation, :status =>
:created,
:location => @bi_allocation} # Doesn’t hit this line
else
format.html { render :action => “xxxx” }
format.xml { render :xml => @bi_allocation.errors }
end
end
end

thanks

try calling it with :format => ‘xml’

<%= link_to “link_name”, :controller => ‘controller_name’, :action =>
‘action_name’, :format => ‘xml’ %>

2009/2/19 MaD [email protected]

try calling it with :format => ‘xml’

<%= link_to “link_name”, :controller => ‘controller_name’, :action =>
‘action_name’, :format => ‘xml’ %>

tks - the remote_form_for method doesn’t mention a “:format” parameter?
actually the “link_to” method (which you used in your example) I see
doesn’t mention this either? Just wondering how one would have found
out
about this being an option here?

regards
Greg