Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

I'm looking for ideas to refactor the below code into something more understandable and less error prone and ugly. Some pages in the application need one off java script included to make a feature work, but it is silly to run the java script on every other page. Any ideas?

View application.html.erb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
 
<body>
...
<script>
$(function() {
<%= yield(:js) %>
});
</script>
</body>
</html>
View application.html.erb
1 2 3 4 5 6 7 8 9 10
<%
str = <<END_OF_STRING
$('.modal').modal()
END_OF_STRING
content_for :js do
str.html_safe
end
%>
Owner

Sorry about the tab/spacing in application.html.erb... I did not paste it in like that, but the github editor refuses to save it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.