Reputation: 2824
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.
Upvotes: 1
Views: 89