Hey all,
I'm building a html helper.
My view looks like this:
= item_view "title", @post.title, :class => 'stuff'
My helper looks like this:
def format_item_data(data) case data when Class then '' when School then school(data) else data.to_s end.to_s.html_safe end
def item_view(label, *args) data = args.first formatter = args.second options = args.extract_options! options[:class] = "pi #{options[:class]}".strip
text = formatter ? send(formatter,data) : format_item_data(data)
content_tag :div, options do content_tag(:div, label, :class => "label") + content_tag(:div, text, :class => "data") end end
I get the following error:
{:class=>"pi stuff"} is not a symbol
I'm not sure why its throwing this exception. I followed this tutorial that says I can pass a hash as part of the argument list:
Thanks for response