Hello, I googled for it but did not find satisfied answer. Problem is that i have a javascript file which need to be loaded on only one page. Also, i am using recursive => true with javascript_include_tag in layout file. So, what i have done is that i moved javascript file to public directory and introduced content_for :head functionality into the view which will pick the script from this public directory. Question is: How to find javascript file''s full path in the view? Thanks in advance. - Hemant -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 5 December 2011 19:05, Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello, > > I googled for it but did not find satisfied answer. Problem is that i > have a javascript file which need to be loaded on only one page. Also, i > am using recursive => true with javascript_include_tag in layout file. > > So, what i have done is that i moved javascript file to public directory > and introduced content_for :head functionality into the view which will > pick the script from this public directory. > > Question is: How to find javascript file''s full path in the view?If the file is public/path/to/file.js then use the url /path/to/file.js (note the leading /). Colin> > > Thanks in advance. > - Hemant > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- gplus.to/clanlaw -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hello Clan, Thanks for your reply. Actually i have the js file in "script" directory not in "public" directory. Is it ok if i do:- root_url + "/script/file_name.js" ? - Hemant clanlaw wrote in post #1035231:> On 5 December 2011 19:05, Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Question is: How to find javascript file''s full path in the view? > If the file is public/path/to/file.js then use the url > /path/to/file.js (note the leading /). > > Colin > >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > > > -- > gplus.to/clanlaw-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 December 2011 11:55, Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello Clan, > > Thanks for your reply. Actually i have the js file in "script" directory > not in "public" directory. > > Is it ok if i do:- root_url + "/script/file_name.js" ?If you look at my reply you will see that will look for public/script/file_name.js. Provided the file is there that will be ok. Why do not just try it and see? Colin> > > - Hemant > > > clanlaw wrote in post #1035231: >> On 5 December 2011 19:05, Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> Question is: How to find javascript file''s full path in the view? >> If the file is public/path/to/file.js then use the url >> /path/to/file.js (note the leading /). >> >> Colin >> >>> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >> >> >> >> -- >> gplus.to/clanlaw > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- gplus.to/clanlaw -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.