Active Record Attributes using Dot Notation doesn't work


#1

I have been having some problems with accessing active record attributes
using dot notation. Some attributes work, others do not. The attribute
exists in the database (it is a smallint). Using breakpointer and IRB I
can see it in the active record:

irb(#Transition:0x3900f48):012:0> self
self
=> #<Transition:0x3900f48
@__bp_file="./script/…/config/…/app/models/transition.rb",
@__bp_line=61, @attributes={“name”=>“ChargeCC”,
“created_on”=>“2006-01-04 18:35:06”, “created_user”=>“wfe_admin”,
“updated_on”=>“2006-01-04 18:35:06”, “lock_version”=>“0”, “id”=>“33”,
“trigger”=>“2”, “description”=>nil, “updated_user”=>“wfe_admin”,
“workflow_id”=>“51”, “time_limit”=>nil}>

When I attempt to access it via dot notation it shows as nil:

irb(#Transition:0x3900f48):013:0> self.trigger
self.trigger
=> nil

Using hash notation it’s there:

irb(#Transition:0x3900f48):014:0> self[“trigger”]
self[“trigger”]
=> 2

One other note. I am accessing this record via a belongs_to/has_many
relationship. It is the parent. I am displaying the child in a view.
The embedded ruby is asking for info on the parent, ie,
“workitem.transition.trigger”.

Any idea what is going on?

Thanks!

Stan Shore