add rough user attributes API

This commit is contained in:
Wen-Tien Chang committed 2010-03-08 17:14:59 +08:00
1 parent 29ee4585b2
commit a40b117fbe
6 files changed
+32 -11

No files matched your search

+12 -2
View File
@@ -3,6 +3,16 @@ class User
devise :authenticatable, :recoverable, :rememberable, :trackable
key :use_attributes
# key :use_attributes
def method_missing(method)
safe_read(method)
end
def safe_read(key)
self[key]
rescue MongoMapper::KeyNotFound
return ""
end
end
+1 -1
View File
@@ -2,7 +2,7 @@ class UserAttribute
include MongoMapper::Document
key :ident, String
key :key, String
key_i18n :name, String
key_i18n :attrs, Array