私のCoffeescript検証は考慮されていないようです:
class PokerRange extends Backbone.Model
defaults:
id:0
cards:[[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12],[0..12]]
validate: (attributes) ->
if attributes.id<0 then "id should be positive"
window.firstrange= new PokerRange id:5
console.log window.firstrange.toJSON()
window.firstrange.set("id",-4)
console.log window.firstrange.toJSON()
結果は次のとおりです。
Object {id: 5, cards: Array[13]}
Object {id: -4, cards: Array[13]}