This project is archived and is in readonly mode.
Namespaced resources fail in production when controllers are not namespaced
-
Dwayne Macgowan
I'm getting the same problem. In slightly different context, not related to routing.
I've got my model
class Persona < ActiveRecord::Base ... endAnd I've got in another model the following:
class Coeficiente < ActiveRecord::Base ... def private.db_field(class_name) table = eval "#{class_name}.table_name" end ... db_field(Persona) ... endhere's my backtrace
0 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 419 in `load_missing_constant' 1 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 77 in `const_missing' 2 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 89 in `const_missing' 3 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 95 in `send' 4 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 95 in `const_missing' 5 /home/kshemac/kshema/demo/releases/20081125002850/app/models/coeficiente.rb 79 in `persona_es_alumna_sql' 6 /home/kshemac/kshema/demo/releases/20081125002850/app/models/instructor.rb 8 7 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 27 in `gem_original_require' 8 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 27 in `require' 9 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 155 in `require' 10 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 262 in `require_or_load' 11 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 221 in `depend_on' 12 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 133 in `require_dependency' 13 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 368 in `load_application_classes' 14 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 367 in `each' 15 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 367 in `load_application_classes' 16 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 365 in `each' 17 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 365 in `load_application_classes' 18 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 185 in `process' 19 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 112 in `send' 20 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb 112 in `run' 21 ./config/environment.rb 9 22 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 27 in `gem_original_require' 23 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 27 in `require' 24 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 153 in `require' 25 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 521 in `new_constants_in' 26 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb 153 in `require' 27 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb 252 in `preload_application' 28 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb 212 in `initialize_server' 29 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb 181 in `report_app_init_status' 30 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb 201 in `initialize_server' 31 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 166 in `start_synchronously' 32 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 135 in `start' 33 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 112 in `fork' 34 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 112 in `start' 35 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb 177 in `start' 36 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/framework_spawner.rb 270 in `handle_spawn_application' 37 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/framework_spawner.rb 263 in `synchronize' 38 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/framework_spawner.rb 263 in `handle_spawn_application' 39 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 317 in `__send__' 40 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 317 in `main_loop' 41 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 168 in `start_synchronously' 42 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 135 in `start' 43 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 112 in `fork' 44 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 112 in `start' 45 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/framework_spawner.rb 87 in `start' 46 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb 218 in `spawn_rails_application' 47 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb 213 in `synchronize' 48 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb 213 in `spawn_rails_application' 49 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb 122 in `spawn_application' 50 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb 247 in `handle_spawn_application' 51 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 317 in `__send__' 52 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 317 in `main_loop' 53 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb 168 in `start_synchronously' 54 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/bin/passenger-spawn-server 46 -
Pratik
Is this still an issue ? Could you please submit a failing test case ? http://guides.rails.info/contrib... should be helpful.
Thanks
-
...
Still getting this problem...
routes.rb
map.namespace :account do |account|
account.resources :sponsorships account.resource :profile, :controller => "users"end
A login form with :url => account_profile_path generates this error:
@@@Processing ApplicationController#create (for ... at 2009-05-19 10:57:44) [POST] Parameters: {"user"=>{"password_confirmation"=>"[FILTERED]", "password"=>"[FILTERED]", "email"=>"*****@gmail.com"}, "commit"=>"Register", "action"=>"create", "controller"=>"account/users"}NameError (uninitialized constant Account::UsersController):@@@
No idea why it's even processing ApplicationController... :S
Again, works fine in development, breaks in production... :(
~Levi Figueira
-
...
NOTE: Why can't I edit a comment? Or at least preview it... :(
Let's hope this one comes out "readable"... :/
Still getting the same problem...
# routes.rb map.namespace :account do |account| account.resources :sponsorships account.resource :profile, :controller => "users" endA login form with :url => account_profile_path generates this error:
@@@ Processing ApplicationController#create (for ... at 2009-05-19 10:57:44) [POST] Parameters: {"user"=>{"password_confirmation"=>"[FILTERED]", "password"=>"[FILTERED]", "email"=>"*****@gmail.com"}, "commit"=>"Register", "action"=>"create", "controller"=>"account/users"}NameError (uninitialized constant Account::UsersController):
No idea why it's even processing ApplicationController... :S Again, works fine in development, breaks in production... :(
~Levi Figueira -
...
I.Give.Up -.-
-
Daniel Guettler
@Thomas, you need to reset the namespace not the controller in your nested resource so it should look like this otherwise it will assume you have a Time::TagsController:
{{{ map.namespace(:time) do |time|
time.resources :tags, :namespace => ''end }}}
-
Daniel Guettler
Ah sorry wrong markup:
map.namespace(:time) do |time| time.resources :tags, :namespace => '' end -
ximus
Some behavior under rails 3 beta3.
-
Andrew White
- Assigned user set to Andrew White
- State changed from new to resolved
- Milestone cleared.
- Importance changed from to
This will now be possible with the 3.0 RC
scope(:path => 'time', :as => :time) do resources :tags end