views:

45

answers:

2

Hi,

I'm writing a rails application, and I need to name one of my model Test, and inside that model I need a class attribute - when I tried the first one, I couldn't run any UT since Test ceased to be a module - so I ranamed to Tst. I haven't even tried naming a column class - I went with clss. What names would you use? Are there any conventions known amongs RoR developers for such situations?

+2  A: 

I haven't seen anything for Test but class is typically changed to klass.

dj2
+1  A: 

Ruby and Rails have several different objects part of a standard library. You cannot use an already-defined class name as name for your models.

For instance, you cannot call a model Thread or Object because Ruby already defines a Thread and Object class. Likewise, Ruby has a library called Test::Unit so you can't use the Test namespace as model name.

There isn't a real full list of reserve objects because it really depends on your current environment. However, in order to successfully use Rails, you should at least have a basic Ruby knowledge so that you know the names of the most common standard library classes.

Simone Carletti
I'm not asking whether I can or cannot use those names - I ask how to name them instead and are there any best known practices to follow.
dahpgjgamgan