Skip to content
Snippets Groups Projects
Commit e4c3b782 authored by Felipe Bombardelli's avatar Felipe Bombardelli
Browse files

add the institutions controller

parent f0a9bdd4
No related branches found
No related tags found
No related merge requests found
class InstitutionsController < ApplicationController
before_action :set_institution, only: [:show, :edit, :update, :destroy, :like]
# GET /institutions
# GET /institutions.json
def index
@institutions = institution_repository.all
end
# GET /institutions/1
# GET /institutions/1.json
def show
end
# GET /institutions/new
def new
@institution = Institution.new
end
# GET /institutions/1/edit
def edit
end
# POST /institutions
# POST /institutions.json
def create
@institution = Institution.new(institution_params)
respond_to do |format|
if institution_repository.save @institution
format.html { redirect_to @institution, notice: 'Institution was successfully created.' }
else
format.html { render :new }
end
end
end
# PATCH/PUT /institutions/1
# PATCH/PUT /institutions/1.json
def update
respond_to do |format|
if institution_repository.update(institution_params)
format.html { redirect_to @learning_object, notice: 'Institution was successfully updated.' }
else
format.html { render :edit }
end
end
end
# DELETE /institutions/1
# DELETE /institutions/1.json
def destroy
institution_repository.destroy @institution
respond_to do |format|
format.html { redirect_to institutions_url, notice: 'Learning object was successfully destroyed.' }
end
end
private
def set_institution
@institution = institution_repository.find("##{params[:id]}")
end
def institution_repository
repository.for(:institution)
end
# Never trust parameters from the scary internet, only allow the white list through.
def institution_params
params[:institution_object]
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment