我試圖寫在軌輔助方法,但對於以下行條件語句中的紅寶石
#if button_source.kind_of?(Array) then list = button_source else list = button_source.sort
完整的代碼
def buttons(model_name, target_property, button_source)
html = ''
list = ''
if button_source.kind_of?(Array) then list = button_source else list = button_source.sort end
list = button_source.sort
list.each do|x|
html << radio_button(model_name, target_property, x[1])
html << h(x[0])
html << '<br />'
end
return html
end
請幫我解決這個問題,由於其拋出錯誤。
什麼是錯誤? – redhotvengeance