Rails 3.1.3

Hi again.

I would like to pass an instance variable to "HERE!!!" in  'save.js.erb'

$('#listtrans').html(
  '<%= escape_javascript(render :partial => "videos/script_list",
:locals => { :scripts => Script.find_all_by_video_id(HERE!!!) } ) %>
');

If I put a specific value, video_id, (18 in this case ) like

$('#listtrans').html('<%= escape_javascript(render :partial =>
"videos/script_list", :locals => { :scripts =>
Script.find_all_by_video_id(18) } ) %>');

works fine.  Of course, this must be generalized.

So I tried,

$('#listtrans').html('<%= escape_javascript(render :partial =>
"videos/script_list", :locals => { :scripts =>
Script.find_all_by_video_id(<%= @video.id %>) } ) %>');

gives an error


ActionView::Template::Error
(/Users/ishidasouichi/Dropbox/Rails/script_youtube/app/views/videos/save.js.erb:3:
syntax error, unexpected '<', expecting ')'
...> Script.find_all_by_video_id(<%= @video.id );@output_buffer...

Also, I tried

@video.id
params[:video_id]
and so on.

Any idea?

Thanks in advance?

soichi

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to