Ruby-on-rails – Rails 3 – Custom XML Response

Currently I am using this:

if @part.save
format.xml {render :xml => @part, :status => :created, :location => @part }
else
format.xml {render :xml => @part.errors, :status => :unprocessable_entity }< br />end

I need a custom response, i.e. xml with OK If the part has been saved correctly, then OKOther.

How can I do this?

Thank you!

Something like this:

< pre>render :xml => {:result => “OK”}.to_xml

This renders

OK< /pre> 

Currently I am using this:

if @part.save
format.xml { render :xml => @part, :status => :created, :location => @part }
else
format.xml {render :xml => @part.errors, :status =>: unprocessable_entity }
end

I need a custom response, i.e. xml with OKIf the part is saved correctly, then OKother .

How can I do this?

Thank you!

Something like this:

render :xml => {:result => "OK"}.to_xml

This is present

OK

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3296 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.