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 -------------------------------- ----[schema.rb] create_table "workunits", :force => true do |t| t.datetime "started_on" t.datetime "ended_on" t.integer "user_id" t.integer "task_id" t.datetime "created_at" t.datetime "updated_at" t.integer "worked_seconds" end ----[workunit.rb] class Workunit < ActiveRecord::Base belongs_to :user belongs_to :task attr_accessor :worked_seconds end -----[workunits_controller.rb] def show @workunit = Workunit.find(params[:id]) session[:current_workunit_id] = @workunit.id respond_to do |format| format.html # show.html.erb format.json { render json: @workunit } end end ----[show.html.erb] <% title "Workunit for: #{@workunit.task.name}" %> <%= @workunit.inspect %> ======> [produces: #<Workunit id: 6 started_on: "2011-07-24 16:00:00" ended_on: "2011-07-24 18:59:00" user_id: 1 task_id: 8 created_at: "2011-07-26 01:46:00" updated_at: "2011-07-26 01:57:44" worked_seconds: 14400 > ======> ] <hr /> <p> <b>Started on:</b> <%= @workunit.started_on.to_s(:long) %> </p> <p> <b>Ended on:</b> <%= @workunit.ended_on.to_s(:long) %> </p> <p> <b>Worked seconds:</b> <%= @workunit.worked_seconds.inspect %> ======> [produces: nil ======> ] </p> <p> <b>User:</b> <%= @workunit.user.email %> </p> <p> <b>Task:</b> <%= @workunit.task.name %> </p> <%= link_to 'Edit', edit_workunit_path(@workunit) %> | <%= link_to 'Back', workunits_path %> ----[Gemfile] source 'http://rubygems.org' gem 'rails', '>= 3.1.0.rc4' gem 'sqlite3' gem 'sass-rails', "~> 3.1.0.rc" gem 'coffee-script' gem 'uglifier' gem 'rspec-rails' gem 'cucumber-rails' gem 'mysql2' gem 'jquery-rails' gem 'webrat', '>= 0.7.2' gem 'devise' gem 'factory_girl_rails' group :test do # Pretty printed test output gem 'turn', :require => false gem 'database_cleaner' end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.