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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:39:34+00:00 2026-06-11T11:39:34+00:00

I’m fairly new to web development in general and I’ve been working on a

  • 0

I’m fairly new to web development in general and I’ve been working on a Ruby on Rails app that I want (eventually) to interact with an Android app. I currently am looking for the most appropriate and safe way to create an object from an http POST that would be sent from the Android app.

The way I’m approaching it to initially achieve this by using a REST client extension for chrome trying to send POSTs to my app on localhost and have it create an object from the POST information.

This is the result of the POST from the chrome extension:

Started POST "/problems" for 127.0.0.1 at 2012-09-15 14:16:19 -0400
Processing by ProblemsController#create as */*
  Parameters: {"user"=>"7876483097", "latitude"=>"18.378383", "longitude"=>"-67.026201", "ptype"=>"2", "description"=>"Poste roto"}
  ←\[1m←\[36m (0.0ms)←\[0m  ←\[1mbegin transaction←\[0m
  ←\[1m←\[35m (0.0ms)←\[0m  rollback transaction
  Rendered problems/new.html.erb within layouts/application (31.0ms)
  Rendered layouts/_shim.html.erb (0.0ms)
  ←\[1m←\[36mUser Load (0.0ms)←\[0m  ←\[1mSELECT "users".* FROM "users" WHERE "users"."remember_token" = 'gdmKIurcqDOMoDGWE4IBng' LIMIT 1←\[0m
  Rendered layouts/_header.html.erb (4.0ms)
  Rendered layouts/_footer.html.erb (1.0ms)
Completed 200 OK in 93ms (Views: 87.0ms | ActiveRecord: 0.0ms)

Right where “rollback transaction” appears means that @problem.save in the create method has failed. Can anybody help identify what I’m missing or how i should change my approach to do it correctly.

Here is my model schema:

  create_table "problems", :force => true do |t|
    t.string   "user"
    t.float    "latitude"
    t.float    "longitude"
    t.integer  "ptype"
    t.string   "description"
    t.integer  "priority"
    t.integer  "status"
    t.datetime "created_at",          :null => false
    t.datetime "updated_at",          :null => false
    t.string   "avatar_file_name"
    t.string   "avatar_content_type"
    t.integer  "avatar_file_size"
    t.datetime "avatar_updated_at"
    t.boolean  "gmaps"
    t.string   "address"
  end

Here is my create method:

  def create
    @problem = Problem.new(params[:problem])
    if @problem.save
      flash[:success] = "Problema guardado"
      redirect_to @problem
    else
      @problem.errors.full_messages
      flash.now[:error] = 'Informacion incorrecta'
      render 'new'
    end
  end

This is the POST body:

user=7876483097&latitude=18.378383&longitude=-67.026201&ptype=2&description=Poste+roto

And, this is the problem model and validations

class Problem < ActiveRecord::Base

    acts_as_gmappable :latitude => 'latitude', :longitude => 'longitude', :process_geocoding => :geocode?,
                  :address => "address", :normalized_address => "address",
                  :msg => "Lo sentimos, ni Google puede localizar esa direccion"

    attr_accessible :user, :latitude, :longitude, :ptype, :description, :avatar, :address
    validates(:user, presence: true)
    validates(:latitude, presence: true)
    validates(:longitude, presence: true)
    validates(:ptype, presence: true)

Thanks in advance.

  • 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-11T11:39:36+00:00Added an answer on June 11, 2026 at 11:39 am

    The problem is with the naming of the fields you send as POST body.

    Note that the new instance of Problem is built using params[:problem].

    Hence the fields are supposed to be named as problem[user], problem[latitute], etc. instead of just user or latitude.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.