I have a code like this in my app/assets/javascripts/sample.js.erb
file.
var user_signed_in = <%= user_signed_in? %>;
if(user_signed_in){
// run code here
}
By the looks of it, with the .js.erb
file extension. This should work. I am able to use the user_signed_in?
in the view that uses this JS file. So why?