return them def self.playlist myarray = new Array myhash = new Hash
Movie.find(:all).each do |movie| myarray,myhash = check_movie(movie,myarray,myhash) end #use of myarray and myhash end def self.check_movie(movie,myarray,myhash) #fill myarray, fill myhash return myarray,myhash end On Nov 13, 10:21 am, David Nguyen <[EMAIL PROTECTED]> wrote: > Hi > > I've got 2 static functions (self.), > playlist function is calling check_movie function in a loop. > > I need to have the results stored in myarray and myhash. > > I don't know how I can give references of myarray and myhash to > check_movie function so myarray and myhash are updated and not emptied > everytime I loop. > > def self.playlist > myarray = new Array > myhash = new Hash > > Movie.find(:all).each do |movie| > check_movie(movie,myarray,myhash) > end > > #use of myarray and myhash > > end > > def self.check_movie(movie,myarray,myhash) > #fill myarray, fill myhash > end > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

