Files
fetsite/app/models/gremium.rb
Andreas Stephanides a3ca1f1f10 gremien + routes update
2013-09-01 10:45:31 +02:00

27 lines
821 B
Ruby

# -*- coding: utf-8 -*-
# == Schema Information
#
# Table name: gremien
#
# id :integer not null, primary key
# name :string(255)
# desc :text
# typ :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
class Gremium < ActiveRecord::Base
TYPEN={1=>"offiziell", 2=>"offiziell-temporär", 3 => "inoffiziell","inoffiziell-tempo"}
GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"}
ART2FALL={0=>"des", 1=>"des",2=>"der"}
attr_accessible :desc, :name, :typ, :geschlecht,:thema_id
has_many :memberships
belongs_to :thema
scope :tabs, { .where(:typ=> 1,:typ=>2)}
def fall2
Gremium::ART2FALL[self.geschlecht.to_i].to_s+" "+ self.name.to_s+ ((self.geschlecht.to_i==1||self.geschlecht.to_i==0)? "s":"")
end
end