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

**URL:** <https://www.ruby-forum.com/t/the-name-friendship-is-reserved-by-ruby-on-rails-messag/106391>\
**Category:** Rails\
**Created:** [June 9, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/the-name-friendship-is-reserved-by-ruby-on-rails-messag/106391 "2007-06-09T17:37:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/3e96dc/32.png) [@victor](https://www.ruby-forum.com/u/victor)\
**Post date:** [June 9, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/the-name-friendship-is-reserved-by-ruby-on-rails-messag/106391/1 "2007-06-09T17:37:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![victor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/3e96dc/32.png) [@victor](https://www.ruby-forum.com/u/victor)\
**Post date:** [June 10, 2007, 3:21am UTC](https://www.ruby-forum.com/t/the-name-friendship-is-reserved-by-ruby-on-rails-messag/106391/2 "2007-06-10T03:21:21Z")

</div>

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
