# Table Record on Sqlite3 DB Not Saving Updates

**URL:** <https://www.ruby-forum.com/t/table-record-on-sqlite3-db-not-saving-updates/171317>\
**Category:** Ruby\
**Created:** [June 30, 2009, 4:50pm UTC](https://www.ruby-forum.com/t/table-record-on-sqlite3-db-not-saving-updates/171317 "2009-06-30T16:50:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rachel\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@Rachel\_N](https://www.ruby-forum.com/u/Rachel_N)\
**Post date:** [June 30, 2009, 4:50pm UTC](https://www.ruby-forum.com/t/table-record-on-sqlite3-db-not-saving-updates/171317/1 "2009-06-30T16:50:37Z")

</div>

Does anyone have an idea of why the record for wsc\_sort\_order does not  
keep the value when I try to set it equal to 2 through console? Per  
below? I am stumped also - when first creating the record I had a  
value for wsc\_uid\_pk, however, as you can see it is nil.

> > cat2 = Webservcat.find\_by\_id(2)

=\> #\<Webservcat id: 2, wsc\_uid\_pk: nil, wsc\_start\_date: “2009-06-29”,

wsc\_active\_fl: “Y”, wsc\_mult\_serv\_types\_fl: “Y”, wsc\_sort\_order: 1,

wsc\_code: “INT”, wsc\_description: “INTERNET”, wsc\_end\_date: nil,

wsc\_system\_code: “INT”, created\_at: “2009-06-29 20:01:43”,  
updated\_at:

“2009-06-29 20:01:43”\>

> > cat2.wsc\_sort\_order = 2

=\> 2

> > cat2.save

=\> true

> > cat2 = Webservcat.find\_by\_id(2)

=\> #\<Webservcat id: 2, wsc\_uid\_pk: nil, wsc\_start\_date: “2009-06-29”,

wsc\_active\_fl: “Y”, wsc\_mult\_serv\_types\_fl: “Y”, wsc\_sort\_order: 1,

wsc\_code: “INT”, wsc\_description: “INTERNET”, wsc\_end\_date: nil,

wsc\_system\_code: “INT”, created\_at: “2009-06-29 20:01:43”,  
updated\_at:

“2009-06-29 20:01:43”\>

> >

---

<div class="post-metadata">

**Author:** ![Rachel\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@Rachel\_N](https://www.ruby-forum.com/u/Rachel_N)\
**Post date:** [June 30, 2009, 10:05pm UTC](https://www.ruby-forum.com/t/table-record-on-sqlite3-db-not-saving-updates/171317/2 "2009-06-30T22:05:23Z")

</div>

I’m guessing, because you didn’t say so, that this is ActiveRecord?  
Remember that Ruby is not Rails, and you are on the Ruby mailing list  
here.

Anyway:

- I believe you should use find(2) rather than find\_by\_id(2), although I  
can’t see why that would cause your problem.

- you haven’t posted your class definition. Is it just

or have you done some other things in there?

- try turning on logging from ActiveRecord or at your database (you  
didn’t say what database you were using either) to check the SQL sent  
and the results

- if you still can’t solve it, better to ask again on a Rails mailing  
list or group, with some more detail about your code, your database  
setup, and the versions of ActiveRecord and Ruby you are using.

Regards,

Brian.
