Sha256: e19a9f26556b05a811eca274ec46158cdfa7792698181445f3f2f9257c0be6ae

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

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(params[:detail])
    @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(params[:detail])
      redirect_to @detail, notice: t('details.update.notice')
    else
      render action: "edit", warning: t('details.update.warning'), layout: 'admin'
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tkh_mailing_list-0.0.1 app/controllers/details_controller.rb