def write_preference(name, value, group = nil)
      name = name.to_s
      assert_valid_preference(name)
      
      preferences_changed = preferences_changed_group(group)
      if preferences_changed.include?(name)
        old = preferences_changed[name]
        preferences_changed.delete(name) unless preference_value_changed?(name, old, value)
      else
        old = clone_preference_value(name, group)
        preferences_changed[name] = old if preference_value_changed?(name, old, value)
      end
      
      value = convert_number_column_value(value) if preference_definitions[name].number?
      preferences_group(group)[name] = value
      
      value
    end
def write_preference(name, value, group = nil)
      name = name.to_s
      assert_valid_preference(name)
      
      preferences_changed = preferences_changed_group(group)
      if preferences_changed.include?(name)
        old = preferences_changed[name]
        preferences_changed.delete(name) unless preference_value_changed?(name, old, value)
      else
        old = clone_preference_value(name, group)
        preferences_changed[name] = old if preference_value_changed?(name, old, value)
      end
      
      value = convert_number_column_value(value) if preference_definitions[name].number?
      preferences_group(group)[name] = value
      
      value
    end
Sets a new value for the given preference.  The actual Preference record
 is *not* created until this record is saved.  In this way, preferences
 act *exactly* the same as attributes.  They can be written to and
 validated against, but won't actually be written to the database until
 the record is saved.

 == Examples

   user = User.find(:first)
   user.write_preference(:color, 'red')              # => "red"
   user.save!

   user.write_preference(:color, 'blue', Car.first)  # => "blue"
   user.save!