ecole_eft_app/app/controllers/admin/notes_controller.rb

56 lines
749 B
Ruby

# -*- encoding : utf-8 -*-
class Admin::NotesController < ApplicationController
before_filter :auth_admin
layout "admin"
def show
@note = Note.find(params[:id])
end
def new
@note = Note.new(:topic_id => params[:topic_id])
end
def edit
@note = Note.find(params[:id])
end
def create
@note = Note.new(params.require(:note).permit!)
@note.admin = current_admin
if @note.save
else
render :action => :new
end
end
def update
@note = Note.find(params[:id])
if @note.update_attributes(params.require(:note).permit!)
else
render :action => :edit
end
end
def destroy
@note = Note.find(params[:id])
@note.destroy
end
end