problem with belongs_to

I'm guessing here, but this statement among other things, adds the "userlevels" (plural) method to user. You're trying to access user.userlevel. (singular).

Try this:

ruby script\console

p User.public_methods.grep(/^user/)

and see what methods are out there.

There might be some magic going on with rails and "method_missing"; that is, some metaprogramming. I'm way out of my league here though, I'm afraid.

Poke around in the console and see; I suspect User#userlevels= probably does exist if you try to execute it in a rails app.

You have many "things", but those things belong to one other "thing".

It's supposed to be easier to read; the jury's out with me on that.