In Ruby instead of
for i in 0...ary.size do
ary[i]
end
you can use Array#each
:
ary.each do |item|
item
end
This is how I would do it in ERB (more or less):
<% %w(Submitted Replied Answered Assigned Started Closed Canceled).each do |status| %>
<option value="<%= status %>"><%= status %></option>
<% end %>
Output:
<option value="Submitted">Submitted</option>
<option value="Replied">Replied</option>
<option value="Answered">Answered</option>
<option value="Assigned">Assigned</option>
<option value="Started">Started</option>
<option value="Closed">Closed</option>
<option value="Canceled">Canceled</option>
Explanation:
%w(Submitted Replied Answered Assigned Started Closed Canceled)
creates the array
<% ary.each do |status| %> ... <% end %>
is a loop that's executed for each element, the variable status
refers to the current element within the loop
<option value="<%= status %>"><%= status %></option>
is the output for each element, <%= status %>
is replaced with the corresponding element (Submitted
, Replied
, ...)