You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It allows for a much cleaner model file without text blocks and js files get syntax highlighting. I am thinking about adding coffeescrip and making the js files unit testable with jasmine and the like.
Wondering if this would be a feature you'd like to see in couchrest_model or i should put it into a separate project.
The text was updated successfully, but these errors were encountered:
Hi. This is a subject I've been thinking about a lot, but never arrived at a decent conclusion. While it is nice to not have Javascript in the models, there are some interesting use cases where it does make sense. For example, using variables inside the javascript or re-using blocks of javascript between multiple maps.
Recently, I've actually started using Rails Concerns to separate the designs. This works quite well! For example:
Having said that, there are clearly benefits to separate files, especially if you want to do some kind of unit tests. The hardest part is deciding on the convention to use. I'd suggest trying to load the files automatically based on path, for example in a Rails project:
I put all the map functions in .js files in a separate folder and i am currently using this to load them:
It allows for a much cleaner model file without text blocks and js files get syntax highlighting. I am thinking about adding coffeescrip and making the js files unit testable with jasmine and the like.
Wondering if this would be a feature you'd like to see in couchrest_model or i should put it into a separate project.
The text was updated successfully, but these errors were encountered: