Array containing fields to display on multiple pages

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs