Say array = [1,2,3]. You can display it in the view, just a call inside the erb tag as follows:
<%= array %>
if you want to iterate through it:
<% array.each do |a| %> <%= a %> Mississippi. <% end %>
or use the helper method:
<%= a.to_sentence %>
How much you can define them, it depends. If this is a static list, you can define them in the model as follows:
class Foo < ActiveRecord::Base BAR = [1,2,3] end
then access them almost everywhere, calling
Foo::BAR
If you are only an array in this particular view, you can assign it to an instance variable in the controller as follows:
class FooController < ApplicationController def index @array = [1,2,3] end end
then call it from the view as follows:
<%= @array %>
source share