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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:56:19+00:00 2026-05-28T04:56:19+00:00

I have an iOS project that sends a Person class with one attribute name

  • 0

I have an iOS project that sends a Person class with one attribute name which is “data” to the server. The server sees it, but sets it to null.

Processing PeopleController#create (for 127.0.0.1 at 2012-01-13 03:55:46) [POST]
  Parameters: {"name"=>"data"}

Person Create (0.4ms)   INSERT INTO "people" ("created_at", "updated_at", "name")
VALUES('2012-01-13 11:55:46', '2012-01-13 11:55:46', NULL)
Completed in 27ms (View: 1, DB: 0) | 200 OK

It’s a scaffold generated Rails app with Person has_many dogs and dogs belongs_to person.
The following is the scaffold generated create method:

def create
  @person = Person.new(params[:person])
  respond_to do |format|
    if @person.save
      flash[:notice] = 'Person was successfully created.'
      format.html { redirect_to(@person) }
      format.xml  { render :xml => @person }
      format.json { render :json => @person }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @person.errors, :status => :unprocessable_entity }
      format.json { render :json => @person.errors, :status => :unprocessable_entity }
    end
  end
end

What am I doing wrong? Do I need to write a custom JSON parser?
I use Rails version 2.3.4 with Ruby 1.8.7.

  • 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-28T04:56:19+00:00Added an answer on May 28, 2026 at 4:56 am

    You are building your model using params[:person]. Or, you can see that the parameters received are {"name"=>"data"}, when they should be {"person" => {"name"=>"data"}}

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

Sidebar

Related Questions

Now I have a Xcode project which is built for iOS 5, but now
A have a iOS-project that I send to my iPad. But when I'm trying
I'm working on an iOS project that has to work from iOS4. I have
Overview I have an iOS project which contains 2 navigation controllers as shown in
I have to make an iPhone project that can process video data in realtime.
I have an iOS project that is built upon a framework project that we
I have a method in an iOS project that calls avformat_open_input() , it runs
I have a piece of code in my iOS project that swaps the texture
Overview I have an iOS project in which I store a list of names
I have an iOS project that I've put in Dropbox to work with 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.