Sha256: 9332b20b4d442c0ca4ac5949e27ed0416b23c4e4f9ac90847acfe9635eb31ab4
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
class DetailsController < ApplicationController before_filter :authenticate before_filter :authenticate_with_admin def show @detail = Detail.find(params[:id]) switch_to_admin_layout end def new @detail = Detail.new switch_to_admin_layout end def edit @detail = Detail.find(params[:id]) switch_to_admin_layout end def create @detail = Detail.new(detail_params) # this is needed or has_secure_password won't validate the saving of a record @detail.password = 'temporary' @detail.password_confirmation = 'temporary' if @detail.save redirect_to @detail, notice: t('details.create.notice') else render action: "new", warning: t('details.create.warning'), layout: 'admin' end end def update @detail = Detail.find(params[:id]) if @detail.update_attributes(detail_params) redirect_to @detail, notice: t('details.update.notice') else render action: "edit", warning: t('details.update.warning'), layout: 'admin' end end def destroy @detail = Detail.find(params[:id]) if @detail.destroy redirect_to users_path, notice: t('details.destroy.notice') else redirect_to users_path, warning: t('details.destroy.warning') end end private # Never trust parameters from the scary internet, only allow the white list through. def detail_params params.require(:detail).permit(:admin, :teacher_status) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tkh_mailing_list-0.9 | app/controllers/details_controller.rb |