Table Record on Sqlite3 DB Not Saving Updates

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”>

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

    class Webservcat < ActiveRecord::Base; end

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.