# Null value in mysql database table

**URL:** <https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801>\
**Category:** Rails\
**Created:** [October 4, 2013, 11:03am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801 "2013-10-04T11:03:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [October 4, 2013, 11:03am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/1 "2013-10-04T11:03:38Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![aneez\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@aneez\_a](https://www.ruby-forum.com/u/aneez_a)\
**Post date:** [October 4, 2013, 11:13am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/2 "2013-10-04T11:13:31Z")

</div>

On 4 October 2013 10:03, Aneez a. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![aneez\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@aneez\_a](https://www.ruby-forum.com/u/aneez_a)\
**Post date:** [October 4, 2013, 11:19am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/3 "2013-10-04T11:19:11Z")

</div>

Hi, actually I am beginner. So can you please tell where is  
development.log ?

---

<div class="post-metadata">

**Author:** ![aneez\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@aneez\_a](https://www.ruby-forum.com/u/aneez_a)\
**Post date:** [October 4, 2013, 11:22am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/4 "2013-10-04T11:22:52Z")

</div>

On Fri, Oct 4, 2013 at 4:19 AM, Aneez a. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![aneez\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@aneez\_a](https://www.ruby-forum.com/u/aneez_a)\
**Post date:** [October 4, 2013, 11:25am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/5 "2013-10-04T11:25:48Z")

</div>

On 4 October 2013 10:19, Aneez a. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://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

---

<div class="post-metadata">

**Author:** ![aneez\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@aneez\_a](https://www.ruby-forum.com/u/aneez_a)\
**Post date:** [October 5, 2013, 5:50pm UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/6 "2013-10-05T17:50:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aneez\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@aneez\_a](https://www.ruby-forum.com/u/aneez_a)\
**Post date:** [October 4, 2013, 11:42am UTC](https://www.ruby-forum.com/t/null-value-in-mysql-database-table/236801/7 "2013-10-04T11:42:13Z")

</div>

Actually I am almost at the end of my project. If I got this I can  
complete my project. Thats why I asked.
