Forum: Ruby on Rails Null value in mysql database table.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F11aa69395ad4d3c8aa20891f7cfb03c?d=identicon&s=25 Aneez a. (aneez_a)
on 2013-10-04 11:03
I want to save four fields(name,latitude,longitude,location) coming from
my android phone to mysql table through ruby. I did the follwing code in
my update file.

def update

      @trackdata_items=Trackdata.new(params[:trackdata_items])

      if @trackdata_items.save

      render :text => '{
          "success":true,
                "info":"ok",
                "data":{
                "tasks":[
                  {"title":"Complete the app"}
                ]
             }
            }'


       else
            render :status => :unprocessable_entity,
           :json => {   :success => false,
                      :info => resource.errors,
                       :data => {} }
    end


  end


But my sql database is updating each time with NULL values. what to do ?
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2013-10-04 11:13
(Received via mailing list)
On 4 October 2013 10:03, Aneez a. <lists@ruby-forum.com> wrote:
> I want to save four fields(name,latitude,longitude,location) coming from
> my android phone to mysql table through ruby. I did the follwing code in
> my update file.
>
> def update
>
>       @trackdata_items=Trackdata.new(params[:trackdata_items])
>
>       if @trackdata_items.save

This looks more like a create action than an update action.

>
>
>
> But my sql database is updating each time with NULL values. what to do ?

First look in development.log to see what parameters are being posted
and which action is called.

Colin
F11aa69395ad4d3c8aa20891f7cfb03c?d=identicon&s=25 Aneez a. (aneez_a)
on 2013-10-04 11:19
Hi, actually I am beginner. So can you please tell where is
development.log ?
52f3528c40e9cf28ad0900886eecb128?d=identicon&s=25 Jordon Bedwell (Guest)
on 2013-10-04 11:22
(Received via mailing list)
On Fri, Oct 4, 2013 at 4:19 AM, Aneez a. <lists@ruby-forum.com> wrote:
> Hi, actually I am beginner. So can you please tell where is
> development.log ?

Most of the time unless you are some weird ass developer it will be
right there in the terminal by way of STDERR because you will
preferably start a non-daemonized testing server, otherwise it will be
in log/development.log relative to the root of your base Rails app.
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2013-10-04 11:25
(Received via mailing list)
On 4 October 2013 10:19, Aneez a. <lists@ruby-forum.com> wrote:
> Hi, actually I am beginner. So can you please tell where is
> development.log ?

In that case start by working right through a good tutorial such as
railstutorial.org (which is free to use online).  That will show you
the basics of Rails.  Do that before starting your own project, it
will save you a lot of time in the long run.

The log in in log/development.log though if you just want to see where
you are going wrong.  But then do the tutorial.

Colin
F11aa69395ad4d3c8aa20891f7cfb03c?d=identicon&s=25 Aneez a. (aneez_a)
on 2013-10-04 11:42
Actually I am almost at the end of my project. If I got this I can
complete my project. Thats why I asked.
F3597a1e9f6a7c4ac2238197e1d82c66?d=identicon&s=25 Space Void (Guest)
on 2013-10-05 17:50
(Received via mailing list)
Run:  tail -f log/development.log from your project root directory
You should see the same log in the terminal where you run your server
This topic is locked and can not be replied to.