Object is populated but attributes are unavailable

Will someone please tell me why this code…

def test

 org = Organization.find(1)

 write_log("Org: #{org.inspect}")

 write_log("Org name: #{org.org_name}")


…is returning the blank org_name below?
Am I accessing the object’s attribute wrong?

Org: #<Organization:0x39c97d0 @attributes={“user_last_name”=>“James”,
“user_first_name”=>“Kevin”, “id”=>“1”, “org_name”=>“James Photographic
Illustration”, “user_email_address”=>“[email protected]”,
“user_password”=>“password”, “user_id”=>“kevin”}>
Org name:

Trying to access org.org_name without using the string interpolation
method gives me a “nil” error. I don’t understand something basic here.


My Stack:
Ruby 1.8.2-15 for Windows
WEBrick 1.3.1
Rails 0.13.1
MySQL 5.0.22-community-nt

Rails mailing list
[email protected]

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