Hello, I''m still relatively new to Ruby/Rails and am in the middle of my first deployment to production. I''ve encountered an odd difference between development and production mode, and I''m not sure what the cause is. My site is set up under two main controllers, "secure" and "admin". Each of these has several sub-controllers, for example: "admin/users", "admin/announcements", etc. On my development site, the links between these controllers all work fine. However, when I moved to production, the links no longer work unless I pass along an :id or other parameter through the querystring params. In other words, this results in a page not found error: <%= link_to ''Announcements'', {:controller => ''admin/announcements'', :action => ''index''} %> And this works: <%= link_to ''Announcements'', {:controller => ''admin/announcements'', :action => ''index'', :id => ''0''} %> And both work in my development environment. Without the parameters, I get the following error in my production.log file: Processing AdminController#announcements (for xxx at xxx) [GET] Session ID: xxx Parameters: {"action"=>"announcements", "controller"=>"admin"} ActionController::UnknownAction (No action responded to announcements): Why is the production box looking for a method within admin whereas the development box is correctly finding the controller? Is this a server setting somewhere? Again, it''s the same code in both locations... -- 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 -~----------~----~----~----~------~----~------~--~---
On Aug 30, 1:58 pm, Brian Sweigard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> On my development site, the links between these controllers all work > fine. However, when I moved to production, the links no longer work > unless I pass along an :id or other parameter through the querystring > params.Perhaps you''ve modified routes.rb without restarting the server in production? Jeff softiesonrails.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 -~----------~----~----~----~------~----~------~--~---
Brian Sweigard
2007-Aug-31 13:10 UTC
Re: Nested Controllers - Development vs. Production mode
Jeff Cohen wrote:> Perhaps you''ve modified routes.rb without restarting the server in > production?I thought of that as well, but I verified that it is the same routes.rb file in both locations and I''ve restarted the server since then. I''m still running into this issue. I don''t have anything in my routes.rb file specific to the nested controllers... could this be the problem? The uncommented lines in my routes file are as follows: ActionController::Routing::Routes.draw do |map| map.connect '''', :controller => ''login'' map.connect '':controller/service.wsdl'', :action => ''wsdl'' map.connect '':controller/:action/:id.:format'' map.connect '':controller/:action/:id'' end The login controller handles user logins, so I redirect users there when they first reach the site. Any other thoughts? -- 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 -~----------~----~----~----~------~----~------~--~---
On Aug 31, 8:10 am, Brian Sweigard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I don''t have anything in my routes.rb file specific to the nested > controllers... could this be the problem? The uncommented lines in my > routes file are as follows:Ah, sorry I thought you were using restful controllers with map.resources. I think yes, the problem is that admin/users (for example) is being matched incorrectly by the catch-all case. Try this: map.connect ''admin/users/:action/:id'', :controller => ''admin/users'' and place it above all of the others. If this helps, you can do the same for the other subcontrollers too. Once working, I think you can simplify all of the admin routes by using path_prefix instead. But try them one at a time first, that''s how I''m able to understand what''s going on first. And let me know if this helps or not. :-) Jeff softiesonrails.com essentialrails.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 -~----------~----~----~----~------~----~------~--~---
Brian Sweigard
2007-Sep-04 18:25 UTC
Re: Nested Controllers - Development vs. Production mode
> map.connect ''admin/users/:action/:id'', :controller => ''admin/users''This worked. Thanks for your help! I''m still not clear on why this why this was only needed once I deployed to my production environment (a shared host). I suppose it has something to do with the way in which my hosting provider has the server configured. Regardless, this did the trick. -- 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 -~----------~----~----~----~------~----~------~--~---
On Sep 4, 1:25 pm, Brian Sweigard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > map.connect ''admin/users/:action/:id'', :controller => ''admin/users'' > > This worked. Thanks for your help!Awesome! Glad to help. Jeff softiesonrails.com essentialrails.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 -~----------~----~----~----~------~----~------~--~---