Can I have conditional javascript in my show.erb.html files?
Something like this:
<%- if File.exists?("/leggle/data/tree_xml.xml") %>
<script type="text/javascript">
...code...
</script>
<%- end %>
and have the javascript code appear only if that file exists??
Yes. With something like this, it’s always easy to just try it out, visit the page, and check the page source to see if it’s there (or see if the JS action happened).