Class: Mouth::Dashboard
Overview
A dashboard has these fields:
id
name
todo: order
Instance Attribute Summary
Attributes inherited from Record
Instance Method Summary collapse
- #all_attributes ⇒ Object
- #destroy ⇒ Object
-
#graphs ⇒ Object
An array of graphs.
Methods inherited from Record
all, collection, create, find, #initialize, #normalize_attributes, #save, #update
Constructor Details
This class inherits a constructor from Mouth::Record
Instance Method Details
#all_attributes ⇒ Object
9 10 11 |
# File 'lib/mouth/dashboard.rb', line 9 def all_attributes self.attributes.tap {|attrs| attrs[:graphs] = graphs.collect(&:all_attributes) } end |
#destroy ⇒ Object
13 14 15 16 |
# File 'lib/mouth/dashboard.rb', line 13 def destroy self.graphs.each(&:destroy) super end |
#graphs ⇒ Object
An array of graphs
19 20 21 22 23 |
# File 'lib/mouth/dashboard.rb', line 19 def graphs @graphs ||= begin Graph.for_dashboard(self.attributes[:id]) end end |