I"Ö (function() { var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; App.Models.Article = (function(superClass) { extend(Article, superClass); Article.identity = "Article"; Article.resources = { url: '/user/articles', paginate: { per: 5, param: "current-page" }, main: { url: '/articles', paginate: { per: 3 } }, admin: { url: '/admin/articles', paginate: { per: 4 } } }; Article.attributes = { title: { validations: { presence: true, length: { within: [3, 255] } } }, content: { validations: { presence: true, length: { minimum: 100 } }, remoteName: "text" }, createdAt: { type: "Date", remoteName: "created_at" }, updatedAt: { type: "Date", remoteName: "updated_at" }, commentsCount: { type: "Int", remoteName: "comments_count" }, publishedAt: { type: "Date", remoteName: "published_at" }, published: {}, adminReview: { remoteName: "admin_review" }, adminRate: { type: "Int", remoteName: "admin_rate" }, categoryId: { type: "Int", remoteName: "category_id" }, adminReviewStartedAt: { remoteName: "admin_review_started_at" } }; Article.receivedSignal = function(signal, data) {}; Article.validate = ["vulgarityLevel"]; function Article(data) { Article.__super__.constructor.call(this, data); this.published = this.publishedAt != null ? true : false; } Article.prototype.receivedSignal = function(signal, data) {}; Article.prototype.vulgarityLevel = function() { if (((this.title != null) && /fuck/i.exec(this.title)) || ((this.content != null) && /fuck/i.exec(this.content))) { return this.addErrorMessage("Article contains strong language.", { "for": 'base' }); } }; Article.prototype.setDefaultValuesForAdminReview = function() { if (this.adminRate == null) { this.adminRate = 3; } if (this.categoryId == null) { this.categoryId = 6; } return this.adminReviewStartedAt = Date.now(); }; return Article; })(App.Models.Base); }).call(this); :ET