I have the following code below in my view:
<script type="text/javascript">
$(document).ready(function(){
$("#button").click(function(event){
if(false) { //even with if (false), this code is still being executed!
<% if obj %>
<% my_method(obj) %>
<% end %>
$("#button").attr("href","/" + obj.my_path);
}
});
});
</script>
As you can see by the comment, the condition for the JavaScript if statement is false, so the block should never be executed. Yet for some reason it is like my JS does not exist and the ERB block is being called. Why is this happening? JS seems to work fine on other pages on the site.
If you need more info about this to help solve the problem ask away and I will try to provide as much information as I can.