Question: I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this:

```
class Participant < ActiveRecord::Base

  @possible_statuses = [
    'exists',
    'paired',
    'quiz_finished',
    'quiz_results_seen',
    'money_sent'
  ]

  def statuses
    @possible_statuses
  end

```

But when I tried the following using rails console:

```
 Participant.first.statuses

```

I am returned nil :(

Why does this happen?
Is there a way to accomplish what I am trying to accomplish?

Answer: 
I would recommend using a constant for this kind of cases:

```
class Participant < ActiveRecord::Base

  STATUSES = [
    'exists',
    'paired',
    'quiz_finished',
    'quiz_results_seen',
    'money_sent'
  ]

```

If you want to access that array from the inside class, just do `STATUSES`, and from the outside class use `Participant::STATUSES`
The best answer for me was to create a class variable, not an instance variable:

```
@@possible_statuses = [
    'exists',
    'paired',
    'chat1_ready',
    'chat1_complete'
]

```

I could then freely access it in methods of the class:

```
  def status=(new_status)
    self.status_data = @@possible_statuses.index(new_status)
  end

```