I am trying to make a javascripts controller work. The only resource I can find on this is here : http://railscasts.com/episodes/88 I have tried everything in the tutorial and the comments including May 22 08 comment by "pi_p master" for respond_to do format etc. and here is my predicament; my application works on my development machine just fine; when I transport the application to my production environment it does not call the javascripts controller; I have the following error : <script type="text/javascript" src="/javascripts/dynamic_units.js"> 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 2<html><head> 3<title>404 Not Found</title> 4</head><body> 5<h1>Not Found</h1> 6<p>The requested URL /javascripts/dynamic_units.js was not found on this server.</p> 7</body></html> Now I have even tried putting in explicitly map.connect '':controller/:action.:format'' as well as : map.js ''/javascripts/ dynamic_units.js'' , :controller=>''javascripts'', :action =>''dynamic_units'' and whatever permutation I could fathom but to no avail. I know the dynamic_units method in javascripts_controller is not called because the logger never outputs any lines. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 28 May 2008, at 05:00, A. Shiraz wrote:> > > > I am trying to make a javascripts controller work. The only resource I > can find on this is here : http://railscasts.com/episodes/88 > > I have tried everything in the tutorial and the comments including May > 22 08 comment by "pi_p master" for respond_to do format etc. and here > is my predicament; my application works on my development machine just > fine; when I transport the application to my production environment it > does not call the javascripts controller; I have the following error :What is your production environment (eg are there some rewrite rules (explicit, or implicit (mod_rails does do this, although I don''t know exactly what rewrites it adds) that mean that your rails code is never called?) Fred> > <script type="text/javascript" src="/javascripts/dynamic_units.js"> > 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> > 2<html><head> > 3<title>404 Not Found</title> > 4</head><body> > 5<h1>Not Found</h1> > 6<p>The requested URL /javascripts/dynamic_units.js was not found on > this server.</p> > 7</body></html> > > Now I have even tried putting in explicitly map.connect > '':controller/:action.:format'' > > as well as : > map.js ''/javascripts/ > dynamic_units.js'' , :controller=>''javascripts'', :action > =>''dynamic_units'' > > and whatever permutation I could fathom but to no avail. > > I know the dynamic_units method in javascripts_controller is not > called because the logger never outputs any lines. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 28 May 2008, at 05:00, A. Shiraz wrote: > >> does not call the javascripts controller; I have the following error : > What is your production environment (eg are there some rewrite rules > (explicit, or implicit (mod_rails does do this, although I don''t know > exactly what rewrites it adds) that mean that your rails code is never > called?) > > FredOk it was an issue with Apache configuration. I had to comment out a line in its httpd ssl conf file that was causing apache to serve a javascript directory statically and bypassing the appserver (mongrel). -- 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-/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 -~----------~----~----~----~------~----~------~--~---
I''m trying to do this now as well. Even in my development machine it says that the js file doesn''t exist. Ryan Bates said in the podcast though that if it doesn''t find the static file, it will then go to the controller. So, it shouldn''t have been because of the apache config right? On Thu, May 29, 2008 at 5:17 AM, Ather Shiraz <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Frederick Cheung wrote: >> On 28 May 2008, at 05:00, A. Shiraz wrote: >> >>> does not call the javascripts controller; I have the following error : >> What is your production environment (eg are there some rewrite rules >> (explicit, or implicit (mod_rails does do this, although I don''t know >> exactly what rewrites it adds) that mean that your rails code is never >> called?) >> >> Fred > > Ok it was an issue with Apache configuration. I had to comment out a > line in its httpd ssl conf file that was causing apache to serve a > javascript directory statically and bypassing the appserver (mongrel).-- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 29 May 2008, at 04:26, Ramon Miguel M. Tayag wrote:> > I''m trying to do this now as well. Even in my development machine it > says that the js file doesn''t exist. Ryan Bates said in the podcast > though that if it doesn''t find the static file, it will then go to the > controller. So, it shouldn''t have been because of the apache config > right? >Who is saying the file doesn''t exist (apache, mongrel, something else?) what is your development setup Fred> On Thu, May 29, 2008 at 5:17 AM, Ather Shiraz > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> Frederick Cheung wrote: >>> On 28 May 2008, at 05:00, A. Shiraz wrote: >>> >>>> does not call the javascripts controller; I have the following >>>> error : >>> What is your production environment (eg are there some rewrite rules >>> (explicit, or implicit (mod_rails does do this, although I don''t >>> know >>> exactly what rewrites it adds) that mean that your rails code is >>> never >>> called?) >>> >>> Fred >> >> Ok it was an issue with Apache configuration. I had to comment out a >> line in its httpd ssl conf file that was causing apache to serve a >> javascript directory statically and bypassing the appserver >> (mongrel). > > -- > Ramon Tayag > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 29 Mai, 05:26, "Ramon Miguel M. Tayag" <ramon.ta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to do this now as well. Even in my development machine it > says that the js file doesn''t exist. Ryan Bates said in the podcast > though that if it doesn''t find the static file, it will then go to the > controller. So, it shouldn''t have been because of the apache config > right?Nope. What Ryan meant was that the Rails Application server will serve the static file if it exists, and if not, go to the controller. This decision is done by Rails, so it has to be done on the acutal app server like mongrel. If you let apache serve the static files, and proxy all other requests to mongrel, the call for this URL will never reach your mongrel as apache sees it as a requests to a static file. Long story cut short: If you would run on mongrel directly, it should work. if you have a frontend server that serves static content, it won''t. You can easily circumvent it by not naming the controller JavascriptsController, but something else e.g. DynjavascriptsController. That way, apache can still serve the real static js files, while the dynamic js files are handled by rails. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I see. It''s working now in development environment, i had to add a route for it! I must''ve missed that his in screencast. Thanks for the clarification! You''re suggestion sounds right, and I''ll change the name of my controller so I won''t run into problems while in production. On Thu, May 29, 2008 at 6:37 PM, Thorsten <duplexxx-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > > > On 29 Mai, 05:26, "Ramon Miguel M. Tayag" <ramon.ta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> I''m trying to do this now as well. Even in my development machine it >> says that the js file doesn''t exist. Ryan Bates said in the podcast >> though that if it doesn''t find the static file, it will then go to the >> controller. So, it shouldn''t have been because of the apache config >> right? > > Nope. What Ryan meant was that the Rails Application server will serve > the static file if it exists, and if not, go to the controller. This > decision is done by Rails, so it has to be done on the acutal app > server like mongrel. > > If you let apache serve the static files, and proxy all other requests > to mongrel, the call for this URL will never reach your mongrel as > apache sees it as a requests to a static file. Long story cut short: > If you would run on mongrel directly, it should work. if you have a > frontend server that serves static content, it won''t. > > You can easily circumvent it by not naming the controller > JavascriptsController, but something else e.g. > DynjavascriptsController. That way, apache can still serve the real > static js files, while the dynamic js files are handled by rails. > > >-- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---