def auto_link
html = ""
prefix = ""
(controller_name / action_name).split("/").each do |path|
path = prefix + path
css_path = path + ".css"
if File.exists? Merb.root / "public" / "stylesheets" / css_path
html << %{<link rel="stylesheet" type="text/css" href="/stylesheets/#{css_path}" /> }
end
js_path = path + ".js"
if File.exists? Merb.root / "public" / "javascripts" / js_path
html << %{<script type="text/javascript" language="javascript" src="/javascripts/#{js_path}"></script>}
end
prefix += path / ""
end
html
end