diff --git a/attribute/attribute.go b/attribute/attribute.go index afbe9d2..368c856 100644 --- a/attribute/attribute.go +++ b/attribute/attribute.go @@ -65,11 +65,12 @@ func RestoreDefault(key string) error { } func Get(key string) string { - var value string - store.DB. - Raw(`select "value" from "attributes" where "key" = ?`, key). - Scan(&value) - return value + a := &Attribute{} + store.DB.Select("value", "default").First(a, "key = ?", key) + if a.Value == "" { + return a.Default + } + return a.Value } func Set(key, value string) error {