allen
2007-Apr-12 10:58 UTC
Problems of "javascript_include_tag", cannot load the js file in.
Hi all, I''m trying to use Ext JS with Rails and am wondering how should I include it in my application. According to the convention of Rails, javascript should be put in /public/javascripts and css should be put in /public/stylesheets, then I''m supposed to use "javascript_include_tag" and "stylesheet_link_tag" to load them to my page. This shall be fine for the js and css files I created myself. But for third-party lib like Ext JS, its internal mechanism highly depends on the relative pathes of all its files (js, css, image, ect.). I think I should keep its own hierarchy in some place and pass pass the full path relative to my document root to "javascript_include_tag". So I put them in /vendor/ext, which I thought is the place for third- party lib and used "/vendor/ext/ext-all.js" to reference the js file I want. But then I received an error in my FireBug said that "no route found to match "/vendor/ext/ext-all.js" with {:method=>:get}". I don''t know why this problem occurs. Did I select the wrong place? I also tried to put ext in /public and /app/ views, but neither of these worked. How can I solve the problem? Thanks a lot. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Roelofs
2007-Apr-12 12:51 UTC
Re: Problems of "javascript_include_tag", cannot load the js file in.
The only files directly accessible to a web browser are those under the public/ directory. Anything else is hidden away and won''t work if you try to access it. If it needs to be accessible to the browser (js, css, static html), it *must* be in public/. Jason On 4/12/07, allen <allenmacyoung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi all, > > I''m trying to use Ext JS with Rails and am wondering how should I > include it in my application. According to the convention of Rails, > javascript should be put in /public/javascripts and css should be put > in /public/stylesheets, then I''m supposed to use > "javascript_include_tag" and "stylesheet_link_tag" to load them to my > page. > > This shall be fine for the js and css files I created myself. But for > third-party lib like Ext JS, its internal mechanism highly depends on > the relative pathes of all its files (js, css, image, ect.). I think I > should keep its own hierarchy in some place and pass pass the full > path relative to my document root to "javascript_include_tag". > > So I put them in /vendor/ext, which I thought is the place for third- > party lib and used "/vendor/ext/ext-all.js" to reference the js file I > want. But then I received an error in my FireBug said that "no route > found to match "/vendor/ext/ext-all.js" with > {:method=>:get}". I don''t know why this problem occurs. Did I > select the wrong place? I also tried to put ext in /public and /app/ > views, but neither of these worked. > > How can I solve the problem? Thanks a lot. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---