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?