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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:45:15+00:00 2026-06-08T12:45:15+00:00

In my rails application I am trying to create a new user from a

  • 0

In my rails application I am trying to create a new user from a json client. However, I am a little stuck on what to send as the json body. The request is properly getting sent to the correct controller, however I keep getting my validations error back as a response. It says the email and username cant be blank. Am I doing someting wrong?

I am POSTing to this url localhost:3000/users.json

I am trying to send this as the json request:

{
 "user":
  {
   "email": "foo@foo.com",
   "username": "noob1",
  }
}

In my create action i have this:

 # POST /users
  # POST /users.json
  def create
    @user = User.new(params[:user])

    respond_to do |format|
      if @user.save
        format.html { redirect_to @user, notice: 'User was successfully created.' }
        format.json { render json: @user, status: :created, location: @user }
      else
        format.html { render action: "new" }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

Here are my routes:

users GET    /users(.:format)          users#index
          POST   /users(.:format)          users#create
 new_user GET    /users/new(.:format)      users#new
edit_user GET    /users/:id/edit(.:format) users#edit
     user GET    /users/:id(.:format)      users#show
          PUT    /users/:id(.:format)      users#update
          DELETE /users/:id(.:format)      users#destroy
  • 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-08T12:45:18+00:00Added an answer on June 8, 2026 at 12:45 pm

    What are you using to send the POST? make sure that you have the Content-Type header set to application/json.

    Also, try POSTing to localhost:3000/users.json.

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

Sidebar

Related Questions

I'm trying to create a user acount on my rails backend via json from
I'm trying to curl POST my Rails application in order to create a new
I'm currently trying to create an email application using Rails and Sendgrid. This application
I am trying to create a chat application on heroku using the following https://github.com/tarnfeld/PusherChat-Rails
I'm trying to make an API for my rails application using JSON responses to
I'm trying to setup a simple timer that gets started from a Rails Application.
I'm creating a Ruby on Rails application, and I'm trying to create/login/logout users. This
I'm stuck on a routing problem within a Rails 3.0.x application. What I'm trying
I have a Rails 2.3.5 application and Im trying to render several Partials from
I'm trying to create a ruby on rails ecommerce application, where potential customers will

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.