Can't read or write a column in Rails 3.1.0 app

Hi All,

I have a very puzzling problem with a Rails 3.1.0.rc4/.rc5 app and I could be missing something very obvious.

I have a table (workunits) with a column (worked_seconds) that I can't read or write. I've run migrations to remove and re-add it and I still have the issue.

If I manually add a value to the column in the table using Sequel Pro, AR returns a record that includes the correct value of the column (see below) but referencing the column via @workunit.worked_seconds returns nil (see below).

I'd appreciate any thoughts and suggestions.

**Leigh

That is the problem, attr_accessor creates access methods that
override those that access the database columns. Remove this line (or
perhaps you meant attr_accessible?).

Colin

Thank you, Colin!! I was pretty sure it was a case of Rails doing what I told it to do and not what I meant for it to do.

I did mean "attr_accessible".

**Leigh