Class: ElFinder2::Command::Mkdir
- Defined in:
- lib/el_finder2/command/mkdir.rb
Instance Method Summary collapse
-
#execute ⇒ Object
Response: added : (Array) Array with a single object - a new directory.
Methods inherited from Base
Methods included from HashUtils
#from_base64url, #to_base64url, #to_path
Constructor Details
This class inherits a constructor from ElFinder2::Command::Base
Instance Method Details
#execute ⇒ Object
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 |