ruby array inside hash is nil.

I assign an array to a hash value. When I inspect it shows the array
but when I try to access the array by the hash index it is nil.
Ideas?

Here is the log output of the inspect hash:

{:has_key=>0, :ext_array=>["Text file (.txt)<br/>", "Rich Text Format
(.rtf)<br/>", "Word Document (.doc, .docx)<br/>"]}

When I do:

h[:ext_array] it is nil.

Chris Habgood wrote:

I assign an array to a hash value. When I inspect it shows the array
but when I try to access the array by the hash index it is nil.
Ideas?

Here is the log output of the inspect hash:

{:has_key=>0, :ext_array=>["Text file (.txt)<br/>", "Rich Text Format
(.rtf)<br/>", "Word Document (.doc, .docx)<br/>"]}

When I do:

h[:ext_array] it is nil.

If u don't mind can u give me the whole code.

I assign an array to a hash value.

h[:ext_array] it is nil.

I copied your hash into IRB and it worked fine:

h = {:has_key=>0, :ext_array=>["Text file (.txt)<br/>", "Rich Text Format

(.rtf)<br/>", "Word Document (.doc, .docx)<br/>"]}
=> {:has_key=>0, :ext_array=>["Text file (.txt)<br/>", "Rich Text
Format\n(.rtf)<br/>", "Word Document (.doc, .docx)<br/>"]}

h[:ext_array]

=> ["Text file (.txt)<br/>", "Rich Text Format\n(.rtf)<br/>", "Word
Document (.doc, .docx)<br/>"]

Can you post the code where you're accessing h[:ext_array] and getting
nil. I think you might be getting nil as the result of an expression
rather than the value from the hash.

i am getting this same exact error message when i try to do a
User.find_by_username('array'). Im have twitter users signed up on my
site and i am trying to find the the users on my site from a
timeline.

When i try <%= User.find_by_username('status.user.screen_name') %> It
returns nil, but if i use <%= status.user.screen_name %> it returns
all the user screen names so i can not figure out what is going wrong.

Take out the single quotes.