forked from bofh/fetsite
studium +picture new Layout
This commit is contained in:
@@ -27,13 +27,14 @@
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
class Studium < ActiveRecord::Base
|
||||
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester
|
||||
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester, :picture, :picture_cache
|
||||
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
|
||||
has_many :semester, :dependent => :destroy
|
||||
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
||||
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||
validates :name, :uniqueness => true, :presence=>true
|
||||
validates :zahl, :presence=>true, :format=>{:with=>/^0(33|66)[0-9]{3}$/}, :uniqueness => true
|
||||
mount_uploader :picture, PictureUploader
|
||||
translates :desc,:shortdesc, :versioning =>true,:fallbacks_for_empty_translations => true
|
||||
def title_context
|
||||
return self.abkuerzung.to_s.strip.empty? ? self.name : self.abkuerzung
|
||||
|
||||
Reference in New Issue
Block a user