Report abuse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
require 'rubygems'
require 'recursively'
require 'facet/hash/stringify_keys'
require 'facet/hash/symbolize_keys'
require 'facet/symbol/to_proc'
nested = [ 'a', 'b', [ 'c', 'd', [ 'e', 'f' ] ], 'g', [ 'h' ] ]
nested.recursively!(&:upcase)
options = {
:find => {
:conditions => {
'first_name' => 'john',
:hair_color => 'brown'
},
'order' => 'last_name',
:limit => 10
},
'create' => {
:conditions => [ "hair_color = ?", 'brown' ]
}
}
options.recursively!(&:symbolize_keys)
options[:find][:conditions][:first_name]
options.recursively!(&:stringify_keys)
options['find']['conditions']['hair_color']
|