Creating a nested session?

}
} Can session hashes only be one level deep? For example,
}
} session[:person_id] = @person.id
} session[:person_full_name] = @person.full_name
}
} works where this returns an Array error:
}
} session[:person][:id] = @person.id
} session[:person][:full_name] = @person.full_name
}
} Error:
} You have a nil object when you didn't expect it!
} You might have expected an instance of Array.
} The error occured while evaluating nil.[]
}
} Is there no way to nest all the person info inside session[:person]?

Remember what you is actually going on here. When you say

session[:person_id] = @person.id

...you are calling []= on the session object. That works fine, because
session supports []=. When you say

session[:person][:id] = @person.id

...you are first calling [] on session and getting a nil back, because it
hasn't been set to anything. You are then calling []= on that nil, which
gives you the error you see. Try this instead:

session[:person] = { :id => @person.id, :full_name => @person.full_name }

With that, session[:person] will contain a hash, and session[:person][:id]
will behave as expected.

--Greg