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
.hashed ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# 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"), :move => self.all(:conditions => {:kind => "Move"}, :order => "position") } end |
Instance Method Details
#validate ⇒ Object
5 6 7 8 9 |
# File 'app/models/category.rb', line 5 def validate unless %w(Income Expense Move).include?(self.kind) errors.add("kind", "#{self.kind.inspect} must be either of Income, Expense, Move") end end |