Rails - associations help

I have two models .

Are you trying to link Dbase to a user as defuser (default_user)?
If so, this would work

class Dbase < ActiveRecord::Base
  belongs_to(:defuser, :class_name => 'User', :foreign_key =>

It would be better rails practice to call the column
"default_user_id", and then make the association like this:

class Dbase < ActiveRecord::Base
  belongs_to(:default_user, :class_name => 'User')

Btw, the column name "type" is a reserved rails. It is used for single
table inheritance.
Unless you are using single table inheritance here, I suggest you
rename it to dbase_type, otherwise you may encounter strange error

Thanks for the code and also for the note. I've changed the var to
db_type. Also, what is the difference between having the :foreign_key
=> 'defuser' and not, in your case of the first code and the 2nd?

Also, is there an IRC channel for rails?