Not as old a message as I've responded to, but this one was from February of 
2012…

On Sep 16, 2013, at 9:26 AM, Minh Quy <[email protected]> wrote:

> you should not use js with erb, it meet serious problem when you change 
> variable rails without change js. You can use client variable gem, checkout 
> more details https://github.com/Coffa/client_variable
> 
> On Thursday, February 16, 2012 12:09:47 PM UTC+7, Ruby-Forum.com User wrote:
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/a5751bb6-8895-4c85-84c1-771ca9e66e1a%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/BDBF0DF2-41BF-48A4-B9BE-E7F2FE2CE561%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to