Created
February 15, 2013 03:50
-
-
Save toolmantim/4958457 to your computer and use it in GitHub Desktop.
An example Rails helper and application layout snippet for Crashmat user configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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