ruby on rails - how to access a variable from controller in .js.erb file inside if condition -


this code written in controller method.

@votetype="up" @video = video.find(params[:vid]) @video.up -= 1 @video.total -= 1 @video.save ld.ld = 0 ld.save respond_to |format|   format.js end 

how access @votetype in .js.erb file inside if condition?

in .js.erb file:

if(<%=@votetype=='up'%>){   //js code here } 

or

 <%if @votetype=='up'%>     // js code  <%end%> 

Comments