seoppc
seoppc

Reputation: 2824

conditional statement in ruby

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

Answers (1)

tgt
tgt

Reputation: 1308

You're missing an end at the end of the if statement.

Upvotes: 1

Related Questions