Closed julien-duponchelle closed 11 years ago
I don't know why it stop working for us
Do you use coffee 1.5.0?
Sounds like a coffeescript bug, because it works fine with coffee 1.4.0.
If I compile your example with coffee 1.4.0 :
this.model.set('readingPosition', new App.Models.ReadingPosition({
book_id: this.model.id,
user_id: App.current_user.id
}));
this.model.set('readingPosition', new App.Models.ReadingPosition({
book_id: this.model.id,
user_id: App.current_user.id
}));
With the latest 1.5.0 :
this.model.set('readingPosition', new App.Models.ReadingPosition)({
book_id: this.model.id,
user_id: App.current_user.id
});
this.model.set('readingPosition', new App.Models.ReadingPosition({
book_id: this.model.id,
user_id: App.current_user.id
}));
I check our gemfile and we have coffee 1.5.0 nice catch
Le vendredi 1 mars 2013 à 10:29, Yves Brissaud a écrit :
I don't know why it stop working for us
Do you use coffee 1.5.0? Sounds like a coffeescript bug, because it works fine with coffee 1.4.0. If I compile your example with coffee 1.4.0 : this.model.set('readingPosition', new App.Models.ReadingPosition({ book_id: this.model.id, user_id: App.current_user.id })); this.model.set('readingPosition', new App.Models.ReadingPosition({ book_id: this.model.id, user_id: App.current_user.id }));
With the latest 1.5.0 : this.model.set('readingPosition', new App.Models.ReadingPosition)({ book_id: this.model.id, user_id: App.current_user.id }); this.model.set('readingPosition', new App.Models.ReadingPosition({ book_id: this.model.id, user_id: App.current_user.id }));
— Reply to this email directly or view it on GitHub (https://github.com/TEA-ebook/teabook-open-reader/pull/30#issuecomment-14279626).
It seem fixed in coffee 1.6.1
Thank you both of you
I don't know why it stop working for us but this lines start to stop working for us. When we have debug the generated javascript we found something strange.
The current code generate this:
But we think it should be:
You can try the two syntax here: http://coffeescript.org/#try:%23Invalid%20JS%0A%20%20%20%20%40model.set%20'readingPosition'%2C%20new%20App.Models.ReadingPosition%0A%20%20%20%20%20%20book_id%3A%20%40model.id%0A%20%20%20%20%20%20user_id%3A%20App.current_user.id%0A%0A%0A%23Valid%20JS%0A%0A%20%20%20%20%40model.set('readingPosition'%2C%20new%20App.Models.ReadingPosition(book_id%3A%20%40model.id%2C%20user_id%3A%20App.current_user.id))%0A%0A