Sha256: a4b092f55abc572b444b3d058050049bb8954447736772503df4403f70e9bea0
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require_dependency "attorney/application_controller" module Attorney class Admin::DocumentsController < ApplicationController http_basic_authenticate_with name: Attorney.http_auth[:name], password: Attorney.http_auth[:password] before_action :set_document, only: [:show, :edit, :update, :destroy] def index @documents = Document.all end def new @document = Document.new end def create @document = Document.new(document_params) if @document.save redirect_to admin_document_url(@document), notice: 'Document was successfully created.' else render :new end end def update if @document.update(document_params) redirect_to admin_document_url(@document), notice: 'Document was successfully updated.' else render :edit end end def destroy @document.destroy redirect_to admin_documents_url, notice: 'Document was successfully destroyed.' end private def set_document @document = Document.find(params[:id]) end def document_params params.require(:document).permit(:slug, :published, :content) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attorney-1.0.0 | app/controllers/attorney/admin/documents_controller.rb |