Victor
2007-Jun-09 15:35 UTC
"The name ''Friendship'' is reserved by Ruby on Rails." message - when generate scaffold
Hi, I am new to Rails. I am using Rails 1.8.5 on win xp. When I try to generate scaffold, using ruby script/generate scaffold Friendship I got the message: "... dependency model The name ''Friendship'' is reserved by Ruby on Rails. Please choose an alternative and run this generator again." If I try to do ruby script/generate scaffold comment it then say: "The name ''CommentsController'' is reserved by Ruby on Rails." What could be wrong? Can anyone explain what''s happening here? Thanks, Victor --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Aaron
2007-Jun-10 01:20 UTC
Re: "The name ''Friendship'' is reserved by Ruby on Rails." message - when generate scaffold
I could not reproduce the Friendship error on my machine. However, I
was able to get the same message by trying the generate a resource
called ActiveRecord. The message comes from raise_class_collision in
commands.rb:
def raise_class_collision(class_name)
message = <<end_message
The name ''#{class_name}'' is reserved by Ruby on Rails.
Please choose an alternative and run this generator again.
end_message
...
This only gets called from one place, class_collisions in the same
file:
# If the last Module exists, check whether the given
# class exists and raise a collision if so.
if last and last.const_defined?(name.camelize)
raise_class_collision(class_name)
end
So somewhere you have a class/module named Friendship already loaded
when the generator runs. This could be from a plugin, gem, lib class,
etc... you have loaded. The "reserved by Ruby on Rails" is a bit
misleading. It could be from Rails, but it also could be from a
number of other places.
Aaron
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---