Created
November 18, 2012 22:18
-
-
Save nicinabox/4107838 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class window.Domain extends Backbone.Model | |
initialize: -> | |
@on 'error', (model, errors) -> | |
console.log errors | |
validate: (attrs) -> | |
errors = [] | |
domains = _.pluck app.Domains, 'url' | |
if _.include(domains, attrs.url) | |
errors.push "URL must be unique" | |
if _.isEmpty attrs.url | |
errors.push "URL cannot be blank" | |
unless _.isEmpty(errors) | |
errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment