Suppose my array looks like this:
People => [
{
ID => /org/div/emp/123,
Person => Jack,
Age => 25
},
{
ID => /org/div/emp/124,
Person => Frank,
Age => 45
},
{
ID => /org/div/emp/125,
Person => Molly,
Age => 30
}
]
I'm passing this array to my view using the @People variable.
My view is simple right now:
<h1>People</h1>
<% @People.each do |person| %>
<%= uri = person[ID].split("/") %>
<p>
Person: <%= person[Person] %> <br/>
Age: <%= person[Age] %> <br/>
ID: <%= uri[4] %>
<br/>
</p>
<% end %>
The problem is that, due to how views work, whenever I split person[ID] it is displayed as an array:
People
["org", "div", "emp", "123"]
Person: Jack
Age: 25
ID: 123
["org", "div", "emp", "124"]
Person: Frank
Age: 45
ID: 124
["org", "div", "emp", "125"]
Person: Molly
Age: 30
ID: 125
How do I go about getting the ID from the URI without the array being displayed?