class Pettanr.Story extends Peta.Binder url: '/stories/' @singular: () -> 'Story' @plural: () -> 'Stories' defaults: { id: null, visible: 0, author_id: null } author: () -> new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id')) overwrite: (options) -> operators = Pettanr.cache.operators return false if not operators.author @set('author_id', operators.author.id) is_visible: (operators = Pettanr.cache.operators) -> switch super(operators) when null return true when false return false else @get('visible') > 0 initialize: (attr = {}, options = {}) -> super(attr, options) if @id @url = @url + @id