Folks, I am a little lost on a Routing error in accessing my javascripts and stylesheets files on production and hopefully someone can help me. Part of what is confusing me is that the same code that works fine on my XP dev box is giving this Routing error when I put it up on the hosting site in production environment. The only difference being the environment itself (prod vs. dev) and that the javascripts and stylesheets directories are symbolic links on production instead of actual directories as on my local dev box. For files like "/javascripts/path/to/my.js" and "/stylesheets/myapp.css" I get error message like ActionController::RoutingError (No route matches "/stylesheets/myapp.css" with {:method=>:get}): /vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'' I have looked at the routes.rb (included below) long enough but can''t see what is causing this Routing error. I also started up a script_console and after loading up ActionController::Routing::Routes in a variable the recognize_path for "stylesheets/myapp.css" fails with the same error but it brings up the page fine on that dev box without any errors - which is a little confusing as well. Here is what I have in my routes.rb map.resources :users, :collection => { :resetpwd => :get, :getnewpwd => :get, :getpwdresetcode => :post } map.resource :session, :controller => ''session'', :collection => { :welcome_home => :get} map.root :controller => ''session'', :action => ''new'' map.activate ''/activate/:activation_code'', :controller => ''users'', :action => ''activate'', :activation_code => nil map.resetpwd ''/resetpwd/:resetpwd_code'', :controller => ''users'', :action => ''resetpwd'', :resetpwd_code => nil map.signup ''/signup'', :controller => ''users'', :action => ''new'' map.login ''/login'', :controller => ''session'', :action => ''new'' map.logout ''/logout'', :controller => ''session'', :action => ''destroy'' map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' Sounds like I am missing something simple. Appreciate any thoughts/pointers. Thanks, -S -- Posted via http://www.ruby-forum.com/.
Why are the stylesheets and javascripts directories symbolic links on production? On May 6, 12:46 pm, Sj Tib <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Folks, > > I am a little lost on a Routing error in accessing my javascripts and > stylesheets files on production and hopefully someone can help me. > > Part of what is confusing me is that the same code that works fine on my > XP dev box is giving this Routing error when I put it up on the hosting > site in production environment. The only difference being the > environment itself (prod vs. dev) and that the javascripts and > stylesheets directories are symbolic links on production instead of > actual directories as on my local dev box. > > For files like "/javascripts/path/to/my.js" and "/stylesheets/myapp.css" > I get error message like > > ActionController::RoutingError (No route matches > "/stylesheets/myapp.css" with {:method=>:get}): > /vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisa tion.rb:66:in > `recognize_path'' > > I have looked at the routes.rb (included below) long enough but can''t > see what is causing this Routing error. > > I also started up a script_console and after loading up > ActionController::Routing::Routes in a variable the recognize_path for > "stylesheets/myapp.css" fails with the same error but it brings up the > page fine on that dev box without any errors - which is a little > confusing as well. > > Here is what I have in my routes.rb > > map.resources :users, :collection => { :resetpwd => :get, :getnewpwd > => :get, :getpwdresetcode => :post } > > map.resource :session, :controller => ''session'', :collection => { > :welcome_home => :get} > > map.root :controller => ''session'', :action => ''new'' > map.activate ''/activate/:activation_code'', :controller => ''users'', > :action => ''activate'', :activation_code => nil > map.resetpwd ''/resetpwd/:resetpwd_code'', :controller => ''users'', > :action => ''resetpwd'', :resetpwd_code => nil > map.signup ''/signup'', :controller => ''users'', :action => ''new'' > map.login ''/login'', :controller => ''session'', :action => ''new'' > map.logout ''/logout'', :controller => ''session'', :action => ''destroy'' > > map.connect '':controller/:action/:id'' > map.connect '':controller/:action/:id.:format'' > > Sounds like I am missing something simple. > > Appreciate any thoughts/pointers. > > Thanks, > -S > -- > Posted viahttp://www.ruby-forum.com/.
I have over 3K files under javascripts (dojo library) that I don''t want to deploy every time. Also, following the advice somewhere, given that javascripts/stylesheets/images don''t change that often, it was recommended to put them in shared and create symbolic links from the deployed public directory. Any thoughts on what could be causing the routing error? -S -- Posted via http://www.ruby-forum.com/.
It sounds like whatever webserver you''re using on the Production machine (eg Apache, Nginx, etc) isn''t actually handling the requests for the requests for the static javascripts/stylesheets. In the case of Apache (I don''t have any real experience with anything else), make sure that Options +FollowSymLinks is in your .htaccess or your vhost container, and also depending on what Ruby app server you''re using, the appropriate rewrite directives are in place to only pass requests to the app server for URI''s that *do not* exists. If you need more precise help, what web server and Ruby app server are you using on the production server? On May 6, 5:23 pm, Freddy Andersen <fre...-RCI/mp9mI1I6GGFevw1D/A@public.gmane.org> wrote:> Why are the stylesheets and javascripts directories symbolic links on > production? > > On May 6, 12:46 pm, Sj Tib <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > Folks, > > > I am a little lost on a Routing error in accessing my javascripts and > > stylesheets files on production and hopefully someone can help me. > > > Part of what is confusing me is that the same code that works fine on my > > XP dev box is giving this Routing error when I put it up on the hosting > > site in production environment. The only difference being the > > environment itself (prod vs. dev) and that the javascripts and > > stylesheets directories are symbolic links on production instead of > > actual directories as on my local dev box. > > > For files like "/javascripts/path/to/my.js" and "/stylesheets/myapp.css" > > I get error message like > > > ActionController::RoutingError (No route matches > > "/stylesheets/myapp.css" with {:method=>:get}): > > /vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisa tion.rb:66:in > > `recognize_path'' > > > I have looked at the routes.rb (included below) long enough but can''t > > see what is causing this Routing error. > > > I also started up a script_console and after loading up > > ActionController::Routing::Routes in a variable the recognize_path for > > "stylesheets/myapp.css" fails with the same error but it brings up the > > page fine on that dev box without any errors - which is a little > > confusing as well. > > > Here is what I have in my routes.rb > > > map.resources :users, :collection => { :resetpwd => :get, :getnewpwd > > => :get, :getpwdresetcode => :post } > > > map.resource :session, :controller => ''session'', :collection => { > > :welcome_home => :get} > > > map.root :controller => ''session'', :action => ''new'' > > map.activate ''/activate/:activation_code'', :controller => ''users'', > > :action => ''activate'', :activation_code => nil > > map.resetpwd ''/resetpwd/:resetpwd_code'', :controller => ''users'', > > :action => ''resetpwd'', :resetpwd_code => nil > > map.signup ''/signup'', :controller => ''users'', :action => ''new'' > > map.login ''/login'', :controller => ''session'', :action => ''new'' > > map.logout ''/logout'', :controller => ''session'', :action => ''destroy'' > > > map.connect '':controller/:action/:id'' > > map.connect '':controller/:action/:id.:format'' > > > Sounds like I am missing something simple. > > > Appreciate any thoughts/pointers. > > > Thanks, > > -S > > -- > > Posted viahttp://www.ruby-forum.com/.
> If you need more precise help, what web server and Ruby app server are > you using on the production server?Thanks and you are right. I need to configure my web server for this to follow symbolic links. I am using a Shared Accelerator on Joyent which has Apache as the web server and Mongrel for the Ruby app server. I am also browsing the discussion forums on Joyent. Thanks for any specifics you can provide on what needs to go there - I will keep that as reference based on what I find on Joyent forums. -S -- Posted via http://www.ruby-forum.com/.