Active Record Attributes using Dot Notation doesn't work

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
=> #<Transition:0x3900f48
@__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
=> nil

Using hash notation it’s there:

irb(#Transition:0x3900f48):014:0> 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,

Any idea what is going on?


Stan Shore

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs