class ModulsController

Public Instance Methods

create() click to toggle source

POST /moduls POST /moduls.json

# File controllers/moduls_controller.rb, line 48
def create
  @modul = Modul.new(params[:modul])
 
  
 respond_to do |format|
   if @modul.save
      format.html { redirect_to modulgruppe_path(@modul.modulgruppen.first), notice: 'Modul was successfully created.' }
      format.json { render json: @modul, status: :created, location: @modul }
   else
      format.html { render action: "new" }
      format.json { render json: @modul.errors, status: :unprocessable_entity }
   end
   end
 
end
destroy() click to toggle source

DELETE /moduls/1 DELETE /moduls/1.json

# File controllers/moduls_controller.rb, line 82
def destroy
  
  @modul = Modul.find(params[:id])
  modulgruppe=@modul.modulgruppen.first
  @modul.destroy


  redirect_to modulgruppe_path(modulgruppe) 
  
end
edit() click to toggle source

GET /moduls/1/edit

# File controllers/moduls_controller.rb, line 39
def edit
  @modul = Modul.find(params[:id])
   if !params[:studium_id].nil?
@studium=Studium.find(params[:studium_id])
end
end
index() click to toggle source

GET /moduls GET /moduls.json

# File controllers/moduls_controller.rb, line 4
def index
 @moduls = Modul.all
 if !params[:studium_id].nil?
@studium=Studium.find(params[:studium_id])
end
  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @moduls }
  end
end
new() click to toggle source

GET /moduls/new GET /moduls/new.json

# File controllers/moduls_controller.rb, line 28
def new
  @modul = Modul.new
  modulgruppe=Modulgruppe.find(params[:modulgruppen_id])
  @modul.modulgruppen<<modulgruppe
  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @modul }
  end
end
show() click to toggle source

GET /moduls/1 GET /moduls/1.json

# File controllers/moduls_controller.rb, line 17
def show
  @modul = Modul.find(params[:id])

    respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @modul }
  end
end
update() click to toggle source

PUT /moduls/1 PUT /moduls/1.json

# File controllers/moduls_controller.rb, line 66
def update
  @modul = Modul.find(params[:id])

  respond_to do |format|
    if @modul.update_attributes(params[:modul])
      format.html { redirect_to url_for(@modul), notice: 'Modul was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @modul.errors, status: :unprocessable_entity }
    end
  end
end