From the rails api:
:primary_key
Specify the name of the column to use as the primary key for the association. By default this is id.
Right now the primary key is hard coded to id so I can't use a different column for associations. I would like to be able to do something like:
case class Group(name: String) extends ActiveRecord {
lazy val users = hasMany[User](primaryKey = "name", foreignKey = "group_name")
}
new Group("my group name").users
// SELECT * FROM users WHERE users.group_name = 'my group name'
From the rails api:
Right now the primary key is hard coded to
idso I can't use a different column for associations. I would like to be able to do something like: