I wish to access my current_user variable from my application.js (I renamed my application.js to application.js.erb so the server could understand my ruby code), so i got something like:
function hello(){ alert("<%= current_user.name %>"); }
But it fails:
How can i get session variables like the current_user from devise gem working from a script located in /assets/my_script.js.erb, i think it should not be abled because theese variables might not be accesisible from public sites, or what should do about this?
Thanks!
Aucun commentaire:
Enregistrer un commentaire