Best way to set up user preferences for multiple users?

I have a User model that contains all of the users' account information, but now I'd like to give each user their own set of preferences. Using a database, what's the "best" solution to this?

I was thinking of setting up a Preference model with something along these lines:

id, user_id, preference_value_1, preference_value_2, etc.

And then for the relationship, doing something like:

class User
has_one :preference

class Preference
has_one :user

Is this the right way to go about doing this, or is there a better way?


Personally I go for the parameter, value type. And then add a special
get_prefs and set_prefs methods to

id, user_id, pref_name, value

class User
has_many :preferences
def get_pref(pref_name) {//returns strinf}
def set_pref(pref_name, value) {//returns bool}

class Preference
belongs_to :user