lib/user_preferences/preference.rb in user_preferences-0.0.3 vs lib/user_preferences/preference.rb in user_preferences-1.0.0
- old
+ new
@@ -6,16 +6,20 @@
validates :value, inclusion: { in: ->(p) { p.permitted_values }}
delegate :binary?, :default, :permitted_values, :lookup, :to_db, to: :definition
def update_value!(v)
- update_attributes!(value: to_db(v))
+ update_attributes!(value: v)
end
def value
lookup(attributes['value'])
end
+ def value=(v)
+ super(to_db(v))
+ end
+
def definition
UserPreferences[category, name]
end
-end
\ No newline at end of file
+end