Hello all, I am attempting to add some jquery to an application that I am developing but I am having trouble getting my newly created .js file to load. I have tried manually requiring my file in the application.js but it still does not seem to load. Is there anything else that I can check to see why my .js file is not loading? So far after adding my .js file, I have checked the html source and also looked in the firebug console to see if it loaded and it is not there. As for a second measure to see if the file is loaded but I just can''t seem to find it I added an alert to the the .js file I wanted loaded and it never executed. I welcome any ideas on how I can resolve this issue. At this moment I am at a stand still till I can understand whats going on :-/ -- 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.
Peter Vandenabeele
2012-Feb-15 18:46 UTC
Re: Can''t seem to get javascripts to load in rails 3.1.3
On Wed, Feb 15, 2012 at 7:13 PM, Vell <lovell.mcilwain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I am attempting to add some jquery to an application that I am developing > but I am having trouble getting my newly created .js file to load. I have > tried manually requiring my file in the application.js but it still does > not seem to load. Is there anything else that I can check to see why my .js > file is not loading? > > So far after adding my .js file, I have checked the html source and also > looked in the firebug console to see if it loaded and it is not there. As > for a second measure to see if the file is loaded but I just can''t seem to > find it I added an alert to the the .js file I wanted loaded and it never > executed. > > I welcome any ideas on how I can resolve this issue. At this moment I am > at a stand still till I can understand whats going on :-/ > >Some generic questions that can focus the problem. In which directory is your new .js file exactly? How did you try to "... I have tried manually requiring my file in the application.js ..." exact code snippet. Are you aware that these lines ../app/assets/javascripts$ cat application.js ... //= require jquery //= require jquery_ujs //= require jquery-ui //= require_tree . are not comments, but determine which code is included for building the assets ? I presume you are now talking about dev environment ? HTH, Peter -- 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.
soldier.coder
2012-Feb-15 19:59 UTC
Re: Can''t seem to get javascripts to load in rails 3.1.3
I am almost certain you are using Rails 3.1 or higher. It has some new assumptions that you may not be aware of. I highly suggest you go to RailsCasts and watch/read episode #265. About 4 minutes into the video, you will have your answer. SC On Feb 15, 1:13 pm, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I am attempting to add some jquery to an application that I am developing > but I am having trouble getting my newly created .js file to load. I have > tried manually requiring my file in the application.js but it still does > not seem to load. Is there anything else that I can check to see why my .js > file is not loading? > > So far after adding my .js file, I have checked the html source and also > looked in the firebug console to see if it loaded and it is not there. As > for a second measure to see if the file is loaded but I just can''t seem to > find it I added an alert to the the .js file I wanted loaded and it never > executed. > > I welcome any ideas on how I can resolve this issue. At this moment I am at > a stand still till I can understand whats going on :-/-- 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.
Carlos Agarie
2012-Feb-15 23:21 UTC
Re: Can''t seem to get javascripts to load in rails 3.1.3
I found the RailsGuides guide about the assets pipeline good enough to understand (and use) it. Here''s the link: http://guides.rubyonrails.org/asset_pipeline.html Good luck! On Feb 15, 5:59 pm, "soldier.coder" <geekprogrammer...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> I am almost certain you are using Rails 3.1 or higher. It has some > new assumptions that you may not be aware of. > I highly suggest you go to RailsCasts and watch/read episode #265. > About 4 minutes into the video, you will have your answer. > > SC > > On Feb 15, 1:13 pm, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hello all, > > > I am attempting to add some jquery to an application that I am developing > > but I am having trouble getting my newly created .js file to load. I have > > tried manually requiring my file in the application.js but it still does > > not seem to load. Is there anything else that I can check to see why my .js > > file is not loading? > > > So far after adding my .js file, I have checked the html source and also > > looked in the firebug console to see if it loaded and it is not there. As > > for a second measure to see if the file is loaded but I just can''t seem to > > find it I added an alert to the the .js file I wanted loaded and it never > > executed. > > > I welcome any ideas on how I can resolve this issue. At this moment I am at > > a stand still till I can understand whats going on :-/-- 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.
On Feb 15, 1:46 pm, Peter Vandenabeele <pe...-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote:> On Wed, Feb 15, 2012 at 7:13 PM, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello all, > > > I am attempting to add some jquery to an application that I am developing > > but I am having trouble getting my newly created .js file to load. I have > > tried manually requiring my file in the application.js but it still does > > not seem to load. Is there anything else that I can check to see why my .js > > file is not loading? > > > So far after adding my .js file, I have checked the html source and also > > looked in the firebug console to see if it loaded and it is not there. As > > for a second measure to see if the file is loaded but I just can''t seem to > > find it I added an alert to the the .js file I wanted loaded and it never > > executed. > > > I welcome any ideas on how I can resolve this issue. At this moment I am > > at a stand still till I can understand whats going on :-/ > > Some generic questions that can focus the problem. > > In which directory is your new .js file exactly?The new .js file is in app/assets/javascripts> > How did you try to "... I have tried manually requiring my file in the > application.js ..." > exact code snippet. > > Are you aware that these lines > > ../app/assets/javascripts$ cat application.js > ... > //= require jquery > //= require jquery_ujs > //= require jquery-ui > //= require_tree . > > are not comments, but determine which code is included for building the > assets ? >Yes I am aware of those lines and I did not remove any of those lines or modify them. When I placed my .js file in the correct location I was under the impression that //= require_tree . would pick up that file so that I would not have to add it manually.> I presume you are now talking about dev environment ?Yes this is development environment> > HTH, > > Peter-- 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.
On Feb 15, 2:59 pm, "soldier.coder" <geekprogrammer...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> I am almost certain you are using Rails 3.1 or higher. It has some > new assumptions that you may not be aware of. > I highly suggest you go to RailsCasts and watch/read episode #265. > About 4 minutes into the video, you will have your answer. >Thanks for the response soldier. I just finished looking at railscast 265 as you suggested but unfortunately it did not tell me anything new. My understanding of assets came from the rails cast #279 (I believe). I think they are saying the same thing.> SC > > On Feb 15, 1:13 pm, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hello all, > > > I am attempting to add some jquery to an application that I am developing > > but I am having trouble getting my newly created .js file to load. I have > > tried manually requiring my file in the application.js but it still does > > not seem to load. Is there anything else that I can check to see why my .js > > file is not loading? > > > So far after adding my .js file, I have checked the html source and also > > looked in the firebug console to see if it loaded and it is not there. As > > for a second measure to see if the file is loaded but I just can''t seem to > > find it I added an alert to the the .js file I wanted loaded and it never > > executed. > > > I welcome any ideas on how I can resolve this issue. At this moment I am at > > a stand still till I can understand whats going on :-/-- 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.
Peter Vandenabeele
2012-Feb-17 12:56 UTC
Re: Re: Can''t seem to get javascripts to load in rails 3.1.3
On Thu, Feb 16, 2012 at 4:28 PM, Vell <lovell.mcilwain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Feb 15, 1:46 pm, Peter Vandenabeele <pe...-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote: > > On Wed, Feb 15, 2012 at 7:13 PM, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello all, > > > > > I am attempting to add some jquery to an application that I am > developing > > > but I am having trouble getting my newly created .js file to load. I > have > > > tried manually requiring my file in the application.js but it still > does > > > not seem to load. Is there anything else that I can check to see why > my .js > > > file is not loading? > > > > > So far after adding my .js file, I have checked the html source and > also > > > looked in the firebug console to see if it loaded and it is not there. > As > > > for a second measure to see if the file is loaded but I just can''t > seem to > > > find it I added an alert to the the .js file I wanted loaded and it > never > > > executed. > > > > > I welcome any ideas on how I can resolve this issue. At this moment I > am > > > at a stand still till I can understand whats going on :-/ > > > > Some generic questions that can focus the problem. > > > > In which directory is your new .js file exactly? > > The new .js file is in app/assets/javascripts > > > > How did you try to "... I have tried manually requiring my file in the > > application.js ..." > > exact code snippet. > > > > Are you aware that these lines > > > > ../app/assets/javascripts$ cat application.js > > ... > > //= require jquery > > //= require jquery_ujs > > //= require jquery-ui > > //= require_tree . > > > > are not comments, but determine which code is included for building the > > assets ? > > > Yes I am aware of those lines and I did not remove any of those lines > or modify them. When I placed my .js file in the correct location I > was under the impression that //= require_tree . would pick up that > file so that I would not have to add it manually. >Yes it should. I just added a test.js for fun I see this in the source of the home page: <head> ... <script src="/assets/test.js?body=1 <view-source:http://localhost:3000/assets/test.js?body=1>" type="text/javascript"></script> ... Is application.js loaded correctly ? Like this: ... <script src="/assets/application.js?body=1 <view-source:http://localhost:3000/assets/application.js?body=1>" type="text/javascript"></script> HTH, Peter -- *** Available for a new project *** Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com http://coderwall.com/peter_v -- 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 Feb 17, 7:56 am, Peter Vandenabeele <pe...-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote:> On Thu, Feb 16, 2012 at 4:28 PM, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Feb 15, 1:46 pm, Peter Vandenabeele <pe...-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote: > > > On Wed, Feb 15, 2012 at 7:13 PM, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello all, > > > > > I am attempting to add some jquery to an application that I am > > developing > > > > but I am having trouble getting my newly created .js file to load. I > > have > > > > tried manually requiring my file in the application.js but it still > > does > > > > not seem to load. Is there anything else that I can check to see why > > my .js > > > > file is not loading? > > > > > So far after adding my .js file, I have checked the html source and > > also > > > > looked in the firebug console to see if it loaded and it is not there. > > As > > > > for a second measure to see if the file is loaded but I just can''t > > seem to > > > > find it I added an alert to the the .js file I wanted loaded and it > > never > > > > executed. > > > > > I welcome any ideas on how I can resolve this issue. At this moment I > > am > > > > at a stand still till I can understand whats going on :-/ > > > > Some generic questions that can focus the problem. > > > > In which directory is your new .js file exactly? > > > The new .js file is in app/assets/javascripts > > > > How did you try to "... I have tried manually requiring my file in the > > > application.js ..." > > > exact code snippet. > > > > Are you aware that these lines > > > > ../app/assets/javascripts$ cat application.js > > > ... > > > //= require jquery > > > //= require jquery_ujs > > > //= require jquery-ui > > > //= require_tree . > > > > are not comments, but determine which code is included for building the > > > assets ? > > > Yes I am aware of those lines and I did not remove any of those lines > > or modify them. When I placed my .js file in the correct location I > > was under the impression that //= require_tree . would pick up that > > file so that I would not have to add it manually. > > Yes it should. I just added a test.js for fun I see this in the source of > the > home page: > > <head> > ... > > <script src="/assets/test.js?body=1 > <view-source:http://localhost:3000/assets/test.js?body=1>" > type="text/javascript"></script> > ...I never saw my individual .js files. The one I am creating is called confirmation.js which that was not loaded.> > Is application.js loaded correctly ? Like this: > > ... > <script src="/assets/application.js?body=1 > <view-source:http://localhost:3000/assets/application.js?body=1>" > type="text/javascript"></script> >I actually don''t see my application.js file either. I am pretty sure before I upgraded to rails 3.1.3 from 3.1.0 I at least saw my application.js file. So now I am even more confused.> HTH, > > Peter > > -- > *** Available for a new project *** > > Peter Vandenabeelehttp://twitter.com/peter_vhttp://rails.vandenabeele.comhttp://coderwall.com/peter_v-- 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.
Jason Fleetwood-Boldt
2012-Feb-21 19:06 UTC
Re: Can''t seem to get javascripts to load in rails 3.1.3
Vell-- With the asset pipeline, you don''t include assets explicitly at /assets/application.js Instead, you use the asset pipeline and let it handle this for you. Re-read the Asset pipeline Rails guide carefully, make sure your config.assets settings are correct (remember, "turned on by default" doesn''t apply if you upgraded from a pre-3.1 rails app -- you have to change the config setting yourself). The assets get compiled into a folder at public/assets/ but you can''t include those explicitly because of the asset ID thumbprint hash that gets added. -Jason On Feb 17, 2012, at 9:47 AM, Vell wrote:> > > On Feb 17, 7:56 am, Peter Vandenabeele <pe...-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote: >> On Thu, Feb 16, 2012 at 4:28 PM, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> On Feb 15, 1:46 pm, Peter Vandenabeele <pe...-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote: >>>> On Wed, Feb 15, 2012 at 7:13 PM, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>> Hello all, >> >>>>> I am attempting to add some jquery to an application that I am >>> developing >>>>> but I am having trouble getting my newly created .js file to load. I >>> have >>>>> tried manually requiring my file in the application.js but it still >>> does >>>>> not seem to load. Is there anything else that I can check to see why >>> my .js >>>>> file is not loading? >> >>>>> So far after adding my .js file, I have checked the html source and >>> also >>>>> looked in the firebug console to see if it loaded and it is not there. >>> As >>>>> for a second measure to see if the file is loaded but I just can''t >>> seem to >>>>> find it I added an alert to the the .js file I wanted loaded and it >>> never >>>>> executed. >> >>>>> I welcome any ideas on how I can resolve this issue. At this moment I >>> am >>>>> at a stand still till I can understand whats going on :-/ >> >>>> Some generic questions that can focus the problem. >> >>>> In which directory is your new .js file exactly? >> >>> The new .js file is in app/assets/javascripts >> >>>> How did you try to "... I have tried manually requiring my file in the >>>> application.js ..." >>>> exact code snippet. >> >>>> Are you aware that these lines >> >>>> ../app/assets/javascripts$ cat application.js >>>> ... >>>> //= require jquery >>>> //= require jquery_ujs >>>> //= require jquery-ui >>>> //= require_tree . >> >>>> are not comments, but determine which code is included for building the >>>> assets ? >> >>> Yes I am aware of those lines and I did not remove any of those lines >>> or modify them. When I placed my .js file in the correct location I >>> was under the impression that //= require_tree . would pick up that >>> file so that I would not have to add it manually. >> >> Yes it should. I just added a test.js for fun I see this in the source of >> the >> home page: >> >> <head> >> ... >> >> <script src="/assets/test.js?body=1 >> <view-source:http://localhost:3000/assets/test.js?body=1>" >> type="text/javascript"></script> >> ... > I never saw my individual .js files. The one I am creating is called > confirmation.js which that was not loaded. >> >> Is application.js loaded correctly ? Like this: >> >> ... >> <script src="/assets/application.js?body=1 >> <view-source:http://localhost:3000/assets/application.js?body=1>" >> type="text/javascript"></script> >> > I actually don''t see my application.js file either. I am pretty sure > before I upgraded to rails 3.1.3 from 3.1.0 I at least saw my > application.js file. So now I am even more confused. > >> HTH, >> >> Peter >> >> -- >> *** Available for a new project *** >> >> Peter Vandenabeelehttp://twitter.com/peter_vhttp://rails.vandenabeele.comhttp://coderwall.com/peter_v > > -- > 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. > >-- 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.
Do you have <%= javascript_include_tag "application" %> in your layout? On Feb 15, 11:13 am, Vell <lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I am attempting to add some jquery to an application that I am developing > but I am having trouble getting my newly created .js file to load. I have > tried manually requiring my file in the application.js but it still does > not seem to load. Is there anything else that I can check to see why my .js > file is not loading? > > So far after adding my .js file, I have checked the html source and also > looked in the firebug console to see if it loaded and it is not there. As > for a second measure to see if the file is loaded but I just can''t seem to > find it I added an alert to the the .js file I wanted loaded and it never > executed. > > I welcome any ideas on how I can resolve this issue. At this moment I am at > a stand still till I can understand whats going on :-/-- 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.