This project is archived and is in readonly mode.
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
-
Eduard Gimenez July 3rd, 2008 @ 04:10 PM
Also, calling controller generator the two times also fails.
$ rails test2
$ cd test2
$ script/generate controller Post
$ script/generate controller Admin::Post
The name 'Admin::PostHelper' is either already used in your application or reserved by Ruby on Rails.
Please choose an alternative and run this generator again.
-
Eduard Gimenez July 3rd, 2008 @ 04:42 PM
Seems it was broken in 2d372d704987e05712ccd937e78d8dbd41242efe
-
Dieter Komendera July 3rd, 2008 @ 06:14 PM
- no changes were found...
-
Dieter Komendera July 3rd, 2008 @ 06:14 PM
I can confirm this bug. I'll attach a quick test case which shows the problem. This test case fails with 2.1 and latest version from github.
-
Dieter Komendera July 3rd, 2008 @ 11:01 PM
- Tag changed from 2.1, bug, generators to 2.1, bug, edge, generators
- Assigned user set to josh
Indeed, with 2d372d704987e05712ccd937e78d8dbd41242efe reverted, everything works fine again.
What was the patch about?
-
Matthijs Langenberg July 9th, 2008 @ 02:17 PM
I've also ran into this with Rails 2.1.0.
mlangenberg-mbp:test-app mlangenberg$ script/generate controller adminblabla/post The name 'Adminblabla::PostHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.
Is this already fixed in the current HEAD?
-
josh July 12th, 2008 @ 04:06 PM
- State changed from new to resolved
-
wildchild August 9th, 2008 @ 01:26 PM
Experiencing the same problem
$ script/generate controller hello::world => OK! $ script/generate controller hello::everyone => The name 'hello' is either already used in your...
-
Bryan T. Richardson August 23rd, 2008 @ 10:13 PM
I'm getting the same as wildchild.
$ script/generate controller World --> works $ script/generate controller Hello::World --> now works $ script/generate controller Hello::Universe --> The name 'hello' is either already used...
-
Claudio Poli August 23rd, 2008 @ 10:17 PM
problem arises when including helper :all in ApplicationController for me.
-
Major Kong August 25th, 2008 @ 09:59 PM
I have tried to augment an existing controller with the scaffold generator and get the same error.
rails foo cd foo script/generate scaffold fum script/generate scaffold fum title:string
BOOM...
"The name 'FumsHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again."
gem list says: rails (2.1.0, 1.2.6)
-
Alexandre da Silva September 17th, 2008 @ 07:59 PM
- Tag changed from 2.1, bug, edge, generators to 2.1, bug, edge, generators
in 2.1.1 seems to be already there:
$ ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
$ rails -v Rails 2.1.1
$ rails test $ cd test
$ script/generate controller Posts ... $ script/generate controller 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.
-
Lakshan Perera October 7th, 2008 @ 05:22 AM
I'm also running the latest edge release but still experience this collision. Any idea what's happening?
-
Matthijs Langenberg October 7th, 2008 @ 08:20 AM
- no changes were found...
-
Major Kong October 7th, 2008 @ 10:44 AM
Is there a way to see what changes were made to the source when the bug was flipped to "resolved"? It would be helpful to read the source in order to try to fix this since it, at least in my opinion, is not fully done.
Or, perhaps this is by design; could someone then please explain to me what the rationale is.
-
Claudio Poli October 8th, 2008 @ 03:48 PM
- Tag changed from 2.1, bug, edge, generators to 2.1, bug, edge, generators
definitely not solved on edge.
again, the problem appears when including
helper :all
in ApplicationController.
-
claytonlz October 11th, 2008 @ 09:07 PM
With "helper :all" in application.rb
$ rails -v Rails 2.1.1
$ ruby -v ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-darwin9.1.0]
$ script/generate rspec_controller 'admin/categories'
The name 'Admin::CategoriesHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.
Without "helper :all" in application.rb
$ script/generate rspec_controller 'admin/categories' ... success
-
josh October 12th, 2008 @ 06:58 PM
- State changed from resolved to open
- Milestone cleared.
- Tag changed from 2.1, bug, edge, generators to generators
I did revert the commit as suggested and applied that failing test.
http://github.com/rails/rails/co...
Apparently, the issue still exists. Any more patches :)
This ticket is holding off the 2.2 beta release.
-
Repository October 14th, 2008 @ 03:45 AM
- State changed from open to resolved
(from [9ab83b1cd1323e0ffebbd287c38aff614c18822c]) Don't include the path when checking class collisions [#545 state:resolved] http://github.com/rails/rails/co...
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>
People watching this ticket
Attachments
Tags
Referenced by
- 562 Controller generator fails to create controller within a module This is likely a duplicate of #545
- 562 Controller generator fails to create controller within a module Yes, this is a duplicate of #545.
- 1059 Bug in script/generate This sounds like a duplicate of #545
- 138 script/generate glitch for controllers in modules I also think this ticket should be reopened since the pat...
- 1059 Bug in script/generate Actually this seems to be a duplicate of #138 but it is r...
- 138 script/generate glitch for controllers in modules Ok, no need to reopen since it seems to be fixed in egde ...
- 1059 Bug in script/generate Follow up on #545
- 545 Bug colliding classes (when they shouldn't) (from [9ab83b1cd1323e0ffebbd287c38aff614c18822c]) Don't i...