This is probably very stupid question but here we go
class Foo < ActiveRecord::Base attr_accessor :group_id end
From irb
If you have a column by the name group_id in the table, than ActiveRecord defines the accessor for you. When you overwrite it as you did, your calls simply searches for a regular instance variable named group_id, which returns nil.