[Proto-Scripty] weird issue with .each and objects

2010-10-10 Thread Steven Albarracin
/* Basically I'm trying the pass an array of objects and pass them into the Test class, but it only seems to be passing in the last object in the array... */ // class to store the id, first, last name Test = Class.create({ options:{}, initialize:function(count,obj){

[Proto-Scripty] Re: weird issue with .each and objects

2010-10-10 Thread T.J. Crowder
Hi, Your problem is in your Test class. You're creating an `options` object on the prototype of your class, which means that it will be *shared* by all instances of your class. Since your constructor is writing to properties on that shared object, naturally multiple calls to the constructor

Re: [Proto-Scripty] weird issue with .each and objects

2010-10-10 Thread Idriz Šunja
You'r creating a new Test obj for each item in the array. I'm guessing that you instead, want to push the results into a singelton Test class holding an array of options for each obj? Idriz On Sun, Oct 10, 2010 at 5:25 AM, Steven Albarracin stevenalbarra...@gmail.com wrote: /* Basically I'm

[Proto-Scripty] Re: weird issue with .each and objects

2010-10-10 Thread Steven Albarracin
Thanks for your suggestions and recommendations... On Oct 10, 6:08 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Your problem is in your Test class. You're creating an `options` object on the prototype of your class, which means that it will be *shared* by all instances of your class.