Skip to content

Instantly share code, notes, and snippets.

@cloke
Created October 1, 2011 19:58
Show Gist options
  • Select an option

  • Save cloke/1256573 to your computer and use it in GitHub Desktop.

Select an option

Save cloke/1256573 to your computer and use it in GitHub Desktop.
Sample Rails App with SC 2
<!-- Application ERB -->
<!DOCTYPE html>
<html>
<head>
<title>Diets</title>
<%= stylesheet_link_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
<%= javascript_include_tag "application" %>
</body>
</html>
<!--Home.erb-->
<script type="text/x-handlebars">
{{#view Diets.MyView}}
<h1>Hello world!</h1>
{{/view}}
</script>
<!-- App JS -->
//= require libs/sproutcore-2.0.beta.3
$(document).ready(function(event){
var Diets = SC.Application.create();
//Diets is created without issue, then the view fails.
Diets.MyView = SC.View.extend({
mouseDown: function() {
window.alert("hello world!");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment