Model problem

Hi Friends!
I’m triying since a few days a go build a model for a group select. I
can’t find where is my error … so, if anyone can help I’ll
appreciate!!!

Here is my code:

class Vicaria

VicariaOption = Struct.new(:id, :name)

def initialize

@OPT = []

end

def options

@OPT

end

def <<(localeTemp)

@OPT << localeTemp

end

class VicariaCourse

attr_reader :vicaria_name, :options

def initialize(name)

@vicaria_name = name
@options = []

end

def <<(option)

 @options << option

end

end

obj= self.new

vicarias = Department.find(:all)

vicarias.each do |vicaria|

locale = VicariaCourse.new(vicaria.name)

ministryname =  Ministry.find_all_by_department_id(vicaria.id)

ministryname.each do |ministry|

  locale << VicariaOption.new(ministry.id, ministry.name)

end

obj << locale

end

obj.options

end

When I tested it in the console I get:

hello = Vicaria.new
=> #<Vicaria:0xb6faea54 @OPT=[]>

Thanks a lot!

RoD