43 lines
774 B
Ruby
43 lines
774 B
Ruby
class Admin::HonorTypesController < OrbitMemberController
|
|
|
|
def index
|
|
end
|
|
|
|
def new
|
|
@honor_type = HonorType.new
|
|
@url = admin_honor_types_path
|
|
end
|
|
|
|
def edit
|
|
@honor_type = HonorType.find(params[:id])
|
|
@url = admin_honor_type_path(@honor_type)
|
|
end
|
|
|
|
def create
|
|
honor_type = HonorType.create(honor_type_params)
|
|
@honor_types = HonorType.all
|
|
end
|
|
|
|
def update
|
|
honor_type = HonorType.find(params[:id]) rescue nil
|
|
if !honor_type.nil?
|
|
honor_type.update_attributes(honor_type_params)
|
|
end
|
|
@honor_types = HonorType.all
|
|
end
|
|
|
|
def destroy
|
|
honor_type = HonorType.find(params[:id]) rescue nil
|
|
if !honor_type.nil?
|
|
honor_type.destroy
|
|
end
|
|
@honor_types = HonorType.all
|
|
end
|
|
|
|
private
|
|
|
|
def honor_type_params
|
|
params.require(:honor_type).permit!
|
|
end
|
|
|
|
end |