I've used the gon gem for this and liked it quite a bit.

https://github.com/gazay/gon

Pierre-Andre M. wrote:

I have a variable created by some ruby in my controller that looks like
this:

@begpoint = row["begpoint"]


and I want to pass it into some js that is referenced from within my
view:

view:

<% javascript_include_tag "play_time" %>



js (play_time):

I am trying to pass "<beg-point> into the js [obviously that<> is not
the right syntax just trying to denote where'd id like the variable to
end up]


var endtime =<beg-point>+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
myPlayer.currentTime = 10505.89;
myPlayer.play();
myPlayer.addEventListener('timeupdate', function(){
if (myPlayer.currentTime>= endtime) {
myPlayer.pause();
}


Can anyone help? Thanks

}, false);

}, false);

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5387C680.30601%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to