View code inside Javascript file on Rails
- by SpyrosP
Hello, previously i had javascript code right in the top of my view and it would work. Then, i learned that you can include the js file using yield and i did just that.
I had rails view code inside my javascript code like :
$( "#exp-progressbar" ).progressbar({
value: <%= ((@quest.end_time - Time.now).to_i * 100 ) / (@quest.duration * 60) %>
});
Now, after i do it with yield, i get an error when i do that in the separate js file. How can i do it now ?