Sha256: 7d03871dcc8fcd47bbaf448b932cb899d7af2c6036fc26442d3e220e4d22dd74

Contents?: true

Size: 457 Bytes

Versions: 3

Compression:

Stored size: 457 Bytes

Contents

module Mouth
  
  # A dashboard has these fields:
  #  id
  #  name
  #  todo: order
  class Dashboard < Record
    
    def all_attributes
      self.attributes.tap {|attrs| attrs[:graphs] = graphs.collect(&:all_attributes) }
    end
    
    def destroy
      self.graphs.each(&:destroy)
      super
    end
    
    # An array of graphs
    def graphs
      @graphs ||= begin
        Graph.for_dashboard(self.attributes[:id])
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mouth-0.8.2 lib/mouth/dashboard.rb
mouth-0.8.1 lib/mouth/dashboard.rb
mouth-0.8.0 lib/mouth/dashboard.rb