You do not have access to this ticket

This project is archived and is in readonly mode.

#545 ✓resolved
Eduard Gimenez

Bug colliding classes (when they shouldn't)

Reported by Eduard Gimenez | July 3rd, 2008 @ 04:06 PM

Creating two classes, controllers, with the same name but in different namespaces (i.e. Post and Admin::Post) fails.


$ rails -v
Rails 2.1.0
$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

$ rails test
$ cd test/
$ script/generate scaffold Posts title:string body:text
$ script/generate controller -t Admin::Posts
The name 'Admin::PostsHelper' is either already used in your application or reserved by Ruby on Rails.
  Please choose an alternative and run this generator again.
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/commands.rb:392:in `raise_class_collision'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/commands.rb:185:in `class_collisions'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/manifest.rb:47:in `send'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/manifest.rb:47:in `send_actions'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/manifest.rb:46:in `each'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/manifest.rb:46:in `send_actions'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/manifest.rb:31:in `replay'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/commands.rb:42:in `invoke!'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../scripts.rb:31:in `run'
  /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/generate.rb:6
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
  script/generate:3

I can reproduce this behavior in the console, but not in the rails tests.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Tags

Referenced by

Pages