Sha256: e8e2956d588a115eadde931ecb2c46f79ad61ffcced31eface97f3460308cfa3
Contents?: true
Size: 818 Bytes
Versions: 5
Compression:
Stored size: 818 Bytes
Contents
class ContentFolderController < ApplicationController respond_to :json rescue_from 'Mongoid::Errors::DocumentNotFound' do |exception| render json: {errors: [exception.message]}, status: 404 end # GET /content_folder # GET /content_folder.json def index content_folder = ContentFolder.last if content_folder.nil? render json: {}, status: :not_found else render json: content_folder end end # POST /content_folder # POST /content_folder.json def create content_folder = ContentFolder.new(params[:content_folder]) ContentFolder.delete_all # TODO: need to validate prior to delete if content_folder.save render json: content_folder, status: :created else render json: content_folder.errors, status: :unprocessable_entity end end end
Version data entries
5 entries across 5 versions & 1 rubygems