How can I map array of objects to required format of array of hashes [{'a': '1'}, {'b': '2'}]

前端 未结 0 979
梦谈多话
梦谈多话 2021-02-02 10:41

How can I map array of objects to required format as below

courses.map do |c|
  {
    \'name\' : c.name,
    \'topic\' : c.topic
  }
end

Its resu

相关标签:
回答
  • 消灭零回复
提交回复
热议问题