【发布时间】:2010-02-02 18:26:34
【问题描述】:
我有这个数组类的对象
>> answers_to_problem
=> [#<Answer id: 807, problem_id: 1, player_id: 53, code: "function y = times2(x
)\r\n y = 2*x;\r\nend", message: nil, score: 12, output: nil, hide: nil, create
d_at: "2010-02-02 11:06:49", updated_at: "2010-02-02 11:06:49", correct_answer:
nil, leader: nil, success: true, cloned_from: nil>]
为了进行二进制检查,我需要访问 success 字段。我不确定我是否在这里使用了正确的术语,所以我无法搜索如何访问它。
answer_to_problems 是这样找到的:
answers_to_problem = Answer.find_all_by_problem_id_and_player_id(current_problem,player_id)
最终,我想做这个检查:
is_correct = (answers_to_problem.success == true)
【问题讨论】: