Class: Category
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Category
- Defined in:
- app/models/category.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.expenses ⇒ Object
28 29 30 |
# File 'app/models/category.rb', line 28 def self.expenses self.all(:conditions => {:kind => "Expense"}) end |
.hashed ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/models/category.rb', line 15 def self.hashed { :income => self.all(:conditions => {:kind => "Income"}, :order => "position"), :expense => self.all(:conditions => {:kind => "Expense"}, :order => "position"), } end |
.incomes ⇒ Object
24 25 26 |
# File 'app/models/category.rb', line 24 def self.incomes self.all(:conditions => {:kind => "Income"}) end |
Instance Method Details
#validate ⇒ Object
5 6 7 8 9 |
# File 'app/models/category.rb', line 5 def validate unless %w(Income Expense).include?(self.kind) errors.add("kind", "#{self.kind.inspect} must be either of Income or Expense") end end |