Class: Todd::Category

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/todd/model.rb

Instance Method Summary collapse

Instance Method Details

#bundle(query = nil, archived = false) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/todd/model.rb', line 144

def bundle query = nil, archived = false
  bund = {
    :type => :category,
    :name => name,
    :tasks => []
  }
  
  found = (query != nil) ? DB.find(query, [id], archived) : self.tasks
  found.each do |task|
    bund[:tasks] << task.bundle if task.archived == archived
  end

  bund
end

#visible?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/todd/model.rb', line 159

def visible?
  (tasks.count > 0)
end