Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (19 sloc) 451 Bytes
class Category < ActiveRecord::Base
acts_as_list
has_many :jobs
validates_presence_of :name, :value
validates_uniqueness_of :value
validates_length_of :value, :within => 4..30
validates_format_of :value, :with => /^[-a-z0-9_]{4,30}$/
def to_param
self.value
end
def self.list
find :all, :order => "position"
end
def self.to_select
list.map do |category|
[category.name, category.id]
end
end
end