Closed kapad closed 4 months ago
I have the following in my controller
@somedata = [ {:key1 => 'hello', :key2 => 'world'}, {:key1 => 'bye', :key2 => 'world'}, {:key1 => 'greetings', :key2 => 'universe'}, ]
and the following in my template
collection @somedata attributes :key1, :key2
From what I understand, this should give me the following json
[ {"key1": "hello", "key2": "world"}, {"key1": "bye", "key2": "world"}, {"key1": "greetings", "key2": "universe"} ]
but what I do get in the json is
[ {}, {}, {} ]
Found the fix, but not really sure if it's a hack or a fix. the view file should be
collection @somedata node do |some_item| attributes :key1 => some_item[:key1], :key2 => some_item[:key2] end
I have the following in my controller
and the following in my template
From what I understand, this should give me the following json
but what I do get in the json is