I have created a helper method for generating a li content tag with a link
def method1(attribute,path,classname={},id={})
content_tag(:li, link_to(attribute, path,:class => classname),:id => id)
end
I am calling the helper method like
<%= method1("BLOGS",blogs_path,"","blog1")%>
In the above case I gave an empty string for class as there is no need for class here, but other places need that.
But if I use an empty string for class , then "blog1" becomes the class ..
How can I resolve this?
I am working on rails 2.3.11
Look into options hashes. This is used just about everywhere in Rails and is perfect for handling clunky method invocations like that.