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 instance variable will only exist when you create the model, since it is not being stored in a database anywhere. You will want to make it a constant as per Nobita's suggestion. Alternatively, you could make it a module like...

```
module Status
  EXISTS = "exists"
  PAIRED = "paired"
  QUIZ_FINISHED = "quiz_finished"
  QUIZ_RESULTS_SEEN = "quiz_results_seen"
  MONEY_SENT = "money_sent"

  def self.all
    [EXISTS, PAIRED, QUIZ_FINISHED, QUIZ_RESULTS_SEEN, MONEY_SENT]
  end
end

```

This gives you a bit more control and flexibility, IMO. You would include this code nested in your model.