I am trying to write Helper method in rails but its throwing error for following line
#if button_source.kind_of?(Array) then list = button_source else list = button_source.sort
The complete code
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
Please help me to resolve this issue, thanks.
您在if语句的末尾缺少结尾。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.