On Jun 24, 7:42 pm, John Merlino <stoici...@aol.com> wrote: > Hey all, > > Out of curiousity, all in Rails grabs all the records and converts > them into an array. Map then iterates through the returned array, > returning a new array. So why even use map here? And then the array > gets passed as local variable bt. And we instantiate object and assign > the bt array as a value of a hash of book_type. I dont see why map is > needed here. > > book_details = BookType.all.map do |bt| > Student.new(:book_type => bt) > end
So what do you think this could be simplified to if the use of map is omitted? Fred > > Thanks for response. -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.