Sha256: 85b101b0e1f8b2425f576634db1ccdb67589645ecc6fc7fa60f1181c778c3bb3

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

module Troo
  class Board < Ohm::Model
    include Ohm::DataTypes
    include ModelHelpers

    attribute :name
    attribute :description
    attribute :default, Type::Boolean
    attribute :closed, Type::Boolean
    attribute :external_board_id

    index :default
    index :external_board_id

    alias_method :default?, :default

    def self.remote(id, options = {})
      External::Board.fetch(id, options).first
    end

    def lists
      Troo::List.find(external_board_id: external_board_id)
    end

    def cards
      Troo::Card.find(external_board_id: external_board_id)
    end

    def decorator(options = {})
      Decorators::Board.new(self, options)
    end

    def presenter(options = {})
      Presenters::Board.new(self, options)
    end

    def set_default!
      Behaviours::SetDefault.for(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/models/board.rb