Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 219827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:52:53+00:00 2026-05-11T18:52:53+00:00

I asked something similar to this before and never got an answer, here’s a

  • 0

I asked something similar to this before and never got an answer, here’s a shortened version

I have a User activeresource model. I make a simple call on my client to the service

response = User.find(id).put(:activate, :activation_code => activation_code)

If there were errors on the service (ie. activation_code didn’t match) I return

render :xml => @user.errors, :status => :unprocessable_entity

So apparently any error response with activeresource must be handled by a resue

rescue ActiveResource::ResourceInvalid

That’s all fine and dandy, except that the response in the initial call does not get set. I have no body from that response at all, so @user.errors is never returned. What do I need to get the proper object back? besides returning 200. Any ‘success’ response code populates the response variable fine. But always returning 200 seems like a mistake.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:52:53+00:00Added an answer on May 11, 2026 at 6:52 pm

    So I was a bit mistaken there, in the rescue block

    rescue ActiveResource::ResourceInvalid => e
    

    e gets populated. The service returns

    render :xml => @user.errors, :unprocessable_entity
    

    So e.response.body contains the errors xml. I then on my client side just say

    user.errors.from_xml(e.response.body)
    

    and the user is now populated with the proper errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although some questions similar to this one have been asked before, this one is
I know this question has been asked in a similar fashion before, but I
Sorry I know similar question have been asked many times before but like most
Here is the reason why this question was being asked: www.devplusplus.com/Tests/CSharp/Hello_World . While similar
Any recommended crypto libraries for Python. I know I've asked something similar in x509
My question is quite relevant to something asked before but I need some practical
(I asked this question in another way , and got some interesting responses but
I asked before about pixel-pushing, and have now managed to get far enough to
I don't know if this has been asked before, but what i'd like to
A related question to one I asked earlier ... Just checking on something: Should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.