我正在尝试在 rails 中编写 Helper 方法,但它会抛出以下行的错误
#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
请帮我解决这个问题,谢谢。