0
這裏是我的問題,我從請求中獲取一個變量並將其存儲在@response中。Rails Hashie輸出
然後我調試響應,調試(@應答),並得到以下輸出:通過鍵入@ response.results
--- !ruby/hash:Hashie::Mash
results:
- !ruby/hash:Hashie::Mash
id: '33098557'
firstName: john
lastName: star
relationship: self
photo: https://foursquare.com/img/blank_boy.png
tips: !ruby/hash:Hashie::Mash
count: 0
lists: !ruby/hash:Hashie::Mash
groups:
- !ruby/hash:Hashie::Mash
type: created
count: 1
items: []
gender: male
homeCity: mexico
bio: ''
contact: !ruby/hash:Hashie::Mash
email: [email protected]
unmatched: !ruby/hash:Hashie::Mash
email: []
我能得到的結果,並獲得debuged此:
---
- !ruby/hash:Hashie::Mash
id: '33098557'
firstName: john
lastName: star
relationship: self
photo: https://foursquare.com/img/blank_boy.png
tips: !ruby/hash:Hashie::Mash
count: 0
lists: !ruby/hash:Hashie::Mash
groups:
- !ruby/hash:Hashie::Mash
type: created
count: 1
items: []
gender: male
homeCity: mexico
bio: ''
contact: !ruby/hash:Hashie::Mash
email: [email protected]
但我不能得到像電子郵件或名字的內部屬性,我如何訪問這些屬性?
我得到這個錯誤 未定義的方法'firstName'爲# –
2012-07-25 03:52:57
我編輯了我的迴應;錯過了調試符號'-',表示'結果'是'Array'。 – deefour 2012-07-25 03:56:36
GREAT !!!!!!!感謝人,榮譽! – 2012-07-25 03:58:20