Class: ElFinder2::Command::Mkdir

Inherits:
Base
  • Object
show all
Defined in:
lib/el_finder2/command/mkdir.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from HashUtils

#from_base64url, #to_base64url, #to_path

Constructor Details

This class inherits a constructor from ElFinder2::Command::Base

Instance Method Details

#executeObject

Response:

added : (Array) Array with a single object - a new directory.


6
7
8
9
10
11
12
13
14
# File 'lib/el_finder2/command/mkdir.rb', line 6

def execute
  new_folder = ElFinder2::Folder.all.merge(@folder.children).create(name: @name)

  fail ElFinder2::Error.new(['errMkdir', @name]) unless new_folder.persisted?

  render json: {
    added: ActiveModel::ArraySerializer.new([new_folder]).as_json
  }
end