Class: Category

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/category.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.arrayObject



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_projectsObject



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_sObject



14
15
16
# File 'app/models/category.rb', line 14

def to_s
  self.send('name_' + I18n.locale.to_s)
end