Safeguards

This commit is contained in:
Thomas Blazek
2013-08-02 12:46:34 +02:00
parent 1c1b0cfe91
commit 58663f25f1
2 changed files with 22 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
# updated_at :datetime not null
class Studium < ActiveRecord::Base
attr_accessible :desc, :name, :typ, :zahl
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe"
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
has_many :semester, :dependent => :destroy
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }

View File

@@ -1,16 +1,28 @@
<% @modul.modulgruppen.each do |g| %>
<ul class="breadcrumb">
<li>
<%= link_to g.studium.name , studium_path(g.studium)%> <span class="divider">/</span></li>
<li><%= link_to g.name , modulgruppe_path(g)%></li>
<%end%>
<% @modul.modulgruppen.each do |g| %>
<% if !g.nil? %>
<li>
<% if !g.studium.nil? %>
<%= link_to g.studium.name , studium_path(g.studium) %>
<% else %>
<li>Studium fehlt!
<% end %>
<span class="divider">/</span></li>
<li><%= link_to g.name , modulgruppe_path(g)%>
<% else %>
<li>Modulgruppe Fehlt
<%end %>
<span class="divider">/</span> </li>
<%end%>
</ul>
<p id="notice"><%= notice %></p>
<%= render @modul %>
<%= link_to 'Add LVA', new_lva_path(:modul_id =>@modul.id) %>
<%= link_to '<i class="icon-pencil"></i>'.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
<%= link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>
<%= render 'layouts/pretty_toolbar' %>
<% # link_to 'Add LVA', %>
<% # link_to '<i class="icon-pencil"></i>'.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
<% # link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>