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
.array ⇒ Object
10 11 12 |
# File 'app/models/category.rb', line 10 def self.array order('name_'+ I18n.locale.to_s + ' ASC').collect { |c| [c.send('name_' + I18n.locale.to_s), c.id] } end |
.with_projects ⇒ Object
6 7 8 |
# File 'app/models/category.rb', line 6 def self.with_projects where("id IN (SELECT DISTINCT category_id FROM projects WHERE state <> 'draft' AND state <> 'rejected')") end |
Instance Method Details
#to_s ⇒ Object
14 15 16 |
# File 'app/models/category.rb', line 14 def to_s self.send('name_' + I18n.locale.to_s) end |