# Array containing fields to display on multiple pages

**URL:** <https://www.ruby-forum.com/t/array-containing-fields-to-display-on-multiple-pages/186482>\
**Category:** Rails\
**Created:** [April 7, 2010, 6:58pm UTC](https://www.ruby-forum.com/t/array-containing-fields-to-display-on-multiple-pages/186482 "2010-04-07T18:58:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 7, 2010, 6:58pm UTC](https://www.ruby-forum.com/t/array-containing-fields-to-display-on-multiple-pages/186482/1 "2010-04-07T18:58:05Z")

</div>

I would like to have an array saving fields to display for an object  
that is used for it’s form on multiple pages.

I have declared the array in each of the controller methods that would  
use it. for example,

def new  
@echantillon = Echantillon.new

@new\_ech\_columns = Array.new

@new\_ech\_columns = [  
[“Brut”,“brut”],  
[“Disponibilite”,“availability”],  
[“numero d’inventaire de l’oeuvre”,“inv”],  
[“denomination”,“name”],  
[“numero du laboratoire”,“oeuvre\_work\_number”],  
[“type d’echantillon”,"echantillont

```
etc....

```

and also in

def edit

@new\_ech\_columns = Array.new

@new\_ech\_columns = [  
[“Brut”,“brut”],  
[“Disponibilite”,“availability”],  
[“numero d’inventaire de l’oeuvre”,“inv”],  
[“denomination”,“name”],  
[“numero du laboratoire”,“oeuvre\_work\_number”],  
[“type d’echantillon”,"echantillon

etc…

and in other methods. Where can I put the array so that I only have  
to define it once and then use it repeatedly on different pages?
