studium nlink added
This commit is contained in:
@@ -28,7 +28,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
|
||||
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
||||
LINKTYPES=["Thema", "Gallery", "Lva"]
|
||||
LINKTYPES=["Thema", "Gallery", "Lva","Studium"]
|
||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||
before_validation :sanitize
|
||||
has_many :nlinks
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
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}$/}
|
||||
@@ -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