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 8767019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:42:02+00:00 2026-06-13T16:42:02+00:00

My rails app serves as API for my android app. I’m wondering when the

  • 0

My rails app serves as API for my android app.
I’m wondering when the request encounters any problem, is there a way to detect which error it is on the server side and return with a specific code?

For example, in my users_controller.rb,

if @user.save
  respond_with(@user)
else  
  render json: {errors: @user.errors.full_messages}
end

The output looks like:

{"errors":["Username can't be blank","Password is too short (minimum is 6 characters)","Email has already been taken"]}

How can I check whether it is because of an error of email or an error of password in the controller? Thanks!

  • 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-06-13T16:42:04+00:00Added an answer on June 13, 2026 at 4:42 pm
    • go to rails console
    • type: u = User.new
    • type: u.valid?
    • type: u.errors

    Examine the result. You should be able to figure it out.

    Alternatively read the documentation: http://api.rubyonrails.org/classes/ActiveModel/Errors.html

    Hint: errors is just an OrderedHash object with some additional convenience methods, like full_messages. It has all the information that you are looking for, just not in full_messages.

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

Sidebar

Related Questions

So Im developing a Rails app- primarily serves API which I want to lock
I'm wondering if there are any gems out there that support both Rails 2
In my rails app, I'm using the SendGrid parse API which posts mail to
I took over a Rails app and am trying to get the Salesforce.com API
I have a rails app that makes web api call , the rails app
I have a Rails application with a public REST API which authenticates API clients
I built a rails API to send send a token upon authorization. The problem
I'm trying to use Microsoft's Translator API in my Rails app. Unfortunately and mostly
In a rails 3 app, I'm using a third party API to save webcam
I've built a Rails app that's pretty simple... you send a request to a

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.