Class: ContentFolderController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ContentFolderController
- Defined in:
- app/controllers/content_folder_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /content_folder POST /content_folder.json.
-
#index ⇒ Object
GET /content_folder GET /content_folder.json.
Instance Method Details
#create ⇒ Object
POST /content_folder POST /content_folder.json
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/content_folder_controller.rb', line 21 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 |
#index ⇒ Object
GET /content_folder GET /content_folder.json
10 11 12 13 14 15 16 17 |
# File 'app/controllers/content_folder_controller.rb', line 10 def index content_folder = ContentFolder.last if content_folder.nil? render json: {}, status: :not_found else render json: content_folder end end |