Forum: Ruby on Rails "The name 'Friendship' is reserved by Ruby on Rails." messag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Victor (Guest)
on 2007-06-09 17:37
(Received via mailing list)
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
Aaron (Guest)
on 2007-06-10 03:21
(Received via mailing list)
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
This topic is locked and can not be replied to.