Reserved resource names?

10 views
Skip to first unread message

Sean Schofield

unread,
Apr 20, 2008, 3:14:05 PM4/20/08
to resource_controller
I tried to create a resource using the following

script/generate scaffold_resource client

I got the following message:

The name 'Client' is reserved by Ruby on Rails.
Please choose an alternative and run this generator again.

I did a bit of searching and I couldn't find anything about the word
"client" being reserved in Rails. I've also already setup my data
model (prior to installing the resources_controller) and I was able to
run my migrations just fine with this name.

Is this a restriction being introduced by r_c?

TIA,

Sean

James Golick

unread,
Apr 20, 2008, 4:12:19 PM4/20/08
to resource_...@googlegroups.com
If rails finds that constant present anywhere in your app, it assumes that it's reserved. It's a bad error message, but that's what's happening.

J.

Sean Schofield

unread,
Apr 20, 2008, 4:32:39 PM4/20/08
to resource_...@googlegroups.com
So are you saying the conflict is with my own client.rb? There are no
such problems with the other pre-existing models that I have.

Sean

James Golick

unread,
Apr 20, 2008, 4:40:26 PM4/20/08
to resource_...@googlegroups.com
Really? Weird.

That was my assumption, because I've run in to the same problem before. Other than that, I've got no idea.

It has nothing to do with r_c's generator, which is really just a modified version of the scaffold_resource generator.

Sean Schofield

unread,
Apr 22, 2008, 3:02:54 PM4/22/08
to resource_controller
James is right that this is something that Rails is complaining
about. I never quite figured out why Rails thought that I had these
constants defined. I ran into another problem trying to create a
vendor resource. I believe the problem with vendor may be that there
are other constants defined in the vendor folder.

Since I had already created my models and I just wanted to stub out
the r_c stuff I added the following hack to the
scaffold_resource_generator.rb that comes with r_c

module Rails
module Generator
module Commands
class Create
def raise_class_collision(class_name)
# Do Nothing
end
end
end
end
end

Just in case anyone else is running into that issue.

Sean
Reply all
Reply to author
Forward
0 new messages