A rails object has following style of info. Say for example, if I do
res.students[0].student_id it prints 1
The rails object is the response from other service and it is a proto.
"Students": [
{
"student_id": "1",
"marks": 66,
"address": 1,234 street,
"name" : "",
},
{
"student_id": "2",
"marks": 97,
"address": 4, 567 street,
"name" : "",
},
]
//Name will be empty in this structure
- But, How can I get all student_id to an array in Ruby on Rails?
- Also, how can I pass an array of student IDs to SQL query and get array of names?