-2
誰かが間違っていることを説明できますか?シンボルを整数に暗黙的に変換しない場合があります
if response[:result]
response[:credentials].each do |cred|
AntHQ.logger.debug "==> #{cred}"
c = app_instance.credentials.find_by(name: cred[:name])
if c && cred[:value]
c.value = cred[:value]
c.expiry = cred[:expiry]
c.save!
end
end
end
エラー
TypeError: no implicit conversion of Symbol into Integer
File "/usr/local/lib/ruby/gems/2.1.0/bundler/gems/ant_light_tasks-01095a3ea065/lib/ant_light_tasks/app/update_credentials.rb" line 16 in []
16行目:
c.value = cred[:value]
例 "応答":私はあなたの答えに感謝
{:result=>true, :credentials=>[{:name=>"access_token", :value=>"...", :expiry=>"..."}]}
「シンボルを整数に暗黙的に変換しない」とは、一般的に、シンボルで配列をインデックスすることを意味します(つまり、実際に配列を持つときにハッシュを持つと思います)。この例のレスポンスはそのエラーを生成すべきではなく、 'find_by'の' cred [:name] 'は16行目の前にそれを引き起こすはずです。では、エラーが発生したときに具体的に 'cred'とは何ですか? –
「Integer1」とは何ですか? – sawa
'AntHQ.logger.debug"とは何か#{cred} "'は吐き出すのですか? – mudasobwa