Navigation Menu

Skip to content

Commit

Permalink
add :as_string key converters
Browse files Browse the repository at this point in the history
  • Loading branch information
al6x committed Apr 6, 2011
1 parent 2e0601d commit 3591117
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/mongo_mapper_ext/plugins/micelaneous.rb
Expand Up @@ -21,7 +21,9 @@ module ClassMethods
to_string: -> v {v.join(', ')}
},
yaml: {
from_string: -> s {YAML.load s},
from_string: -> s {
{YAML.load s}rescue{{}}
},
to_string: -> v {
# MongoMapper uses it's internal Hash that doesn't support to_yaml
hash = {}; v.each{|k, v| hash[k] = v}
Expand Down

0 comments on commit 3591117

Please sign in to comment.