forked from bofh/fetsite
studium nlink added
This commit is contained in:
@@ -29,7 +29,8 @@
|
||||
class Studium < ActiveRecord::Base
|
||||
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester, :picture, :picture_cache, :qualifikation,:struktur, :jobmoeglichkeiten
|
||||
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
|
||||
|
||||
scope :search, ->(query) {where("name like ? or studien.desc like ?", "%#{query}%", "%#{query}%")}
|
||||
|
||||
has_many :semester, :dependent => :destroy
|
||||
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
||||
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||
@@ -40,7 +41,11 @@ class Studium < ActiveRecord::Base
|
||||
def title_context
|
||||
return self.abkuerzung.to_s.strip.empty? ? self.name : self.abkuerzung
|
||||
end
|
||||
has_many :nlinks, as: :link
|
||||
|
||||
def title
|
||||
self.name
|
||||
end
|
||||
def batch_add_semester
|
||||
# Semester automatisch zu Studien hinzufügen
|
||||
if self.typ == "Bachelor"
|
||||
|
||||
Reference in New Issue
Block a user