I'm trying to write a helper method that accepts the name of a plural resource and returns a corresponding link. The essence of the method is:
def get_link(resource)
link_to "#{resource.capitalize}", resource_path
end
—Clearly the resource_path
part above doesn't work. What I'd like is to be able to pass foos
to get foos_path
and bars
to get bars_path
etc. How can I do that? I can't quite work out the syntax.