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