My coffee scripts contain chained object calls that compile correctly when using the last compiler (manually), but cannot compile correctly when using the rails / coffee-script tools in the asset pipeline.
What is the best way to get around this? It is preferable to use the latest coffee compiler.
Here is an example of my coffee script, with chain calls
someObject
.chainedMethod 'home', {
paramA: 'a'
paramB: 'b'
}
.chainedMethod 'signin', {
paramA: 'xx'
paramB: 'yy'
controller: 'SignInController'
}
When compiled correctly, it looks like this:
someObject.chainedMethod('home', {
paramA: 'a',
paramB: 'b'
}).chainedMethod('signin', {
paramA: 'xx',
paramB: 'yy',
controller: 'SignInController'
});
The Rails 4.0 Resource Pipeline creates the following:
someObject.chainedMethod('home', {
paramA: 'a',
paramB: 'b'
}.chainedMethod('signin', {
paramA: 'xx',
paramB: 'yy',
controller: 'SignInController'
}));
source
share