Simple ERB question

Hello, not sure if this should go here...

Trying to print out the contents of an array with a little bit of
formatting

my array looks like this:

search = "[[67749303, 72756004, 178055737, 398925700, 551708624,
684936218, 846436579, 978955981]]"

search_ary = search.split(",")

now in my erb view file I would like to print something like this to the
html:

<p>67749303</p>
<p>72756004</p>
....etc

what is the best way to do this???

Not sure of the "best" way... but there are lots of ways - here's two:

You could render a collection of partials as described on
http://api.rubyonrails.org/classes/ActionView/Partials.html

You could loop yourself:

<% search_ary.each do |element| %>
  <%= content_tag :p, element %>
<% end %>

By the way, did your example array mean to be nested in another array
(two lots of square brackets...)?

Assign your search array to an instance variable in your controller.

@search_ary = search.split(",")

In your view do:

<% @search_ary.each do |row| %>
  <p><%= row %></p>
<% end %>

Hello, not sure if this should go here…

Trying to print out the contents of an array with a little bit of

formatting

my array looks like this:

search = "[[67749303, 72756004, 178055737, 398925700, 551708624,

684936218, 846436579, 978955981]]"

<% search.each do |number| %>

<%= number %>

<% end %>

This will give result as below