Michael Wilkes
2006-Aug-02 01:07 UTC
[Rails] 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}")
end
----------------------------------------------
...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"=>"xxx@fakename.com",
"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.
------------------------------------------
Thanks,
Michael
-------------------------------------------
My Stack:
Ruby 1.8.2-15 for Windows
WEBrick 1.3.1
Rails 0.13.1
MySQL 5.0.22-community-nt
--
Posted via http://www.ruby-forum.com/.
Pete Wright
2006-Aug-02 01:40 UTC
[Rails] Object is populated but attributes are unavailable
Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060802/502b6a1d/PGP.bin