Foo = Class.create();
Foo.prototype = {
    initialize: function() {
        var array = $A([1, 2, 3]);
        array.each(function (i) {
              this.hello();
        }.bind(this));
    },
    hello: function() {
        alert('hello');
    }
};
Gareth Evans wrote:
For my, and other group members benefit, could you please paste your final solution?
I do not know what you mean by with(this) so I want to see in case it is a better solution for the problem if I have it in the future.
 
Gareth

 
On 3/17/07, zven <[EMAIL PROTECTED]> wrote:

Thx, Gareth. I already found solution. Other possible solution is:
with(this) { ... }

On Mar 17, 8:58 am, "Gareth Evans" < [EMAIL PROTECTED]> wrote:
> Sorry i put the definition for self in the wrong place
>
>  Foo = Class.create();
> Foo.prototype = {
>    initialize: function() {
>        var self = this;
>        var array = $A([1, 2, 3]);
>        array.each(function (i) {
>            self.hello();
>        });
>    },
>
>    hello: function() {
>        alert('hello');
>    }
>
> }
>
> On 3/17/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
>





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---




Reply via email to