# Active Record Attributes using Dot Notation doesn't work

**URL:** <https://www.ruby-forum.com/t/active-record-attributes-using-dot-notation-doesnt-work/51983>\
**Category:** Rails\
**Created:** [January 9, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/active-record-attributes-using-dot-notation-doesnt-work/51983 "2006-01-09T22:33:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stan\_Shore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@Stan\_Shore](https://www.ruby-forum.com/u/Stan_Shore)\
**Post date:** [January 9, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/active-record-attributes-using-dot-notation-doesnt-work/51983/1 "2006-01-09T22:33:13Z")

</div>

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
