Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Created February 15, 2013 03:50
Show Gist options
  • Select an option

  • Save toolmantim/4958457 to your computer and use it in GitHub Desktop.

Select an option

Save toolmantim/4958457 to your computer and use it in GitHub Desktop.
An example Rails helper and application layout snippet for Crashmat user configuration.
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<script>
window.Crashmat = {
key: "[your key]",
user: <%= raw crashmat_user.to_json.gsub("</", "<\\/") %>
};
<!-- [crashmat snippet] -->
</script>
<%= javascript_include_tag "application" %>
</head>
<body>
<%= yield %>
</body>
</html>
module CrashmatHelper
def crashmat_user
# Customize as necessary
current_user && {
"id" => current_user.id,
"name" => current_user.name
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment