Class: Ckpages::UploadsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Ckpages::UploadsController
- Defined in:
- app/controllers/ckpages/uploads_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /uploads.
- #index ⇒ Object
- #show ⇒ Object
Instance Method Details
#create ⇒ Object
POST /uploads
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/ckpages/uploads_controller.rb', line 15 def create @upload = Upload.new(upload_params) #{"fileName":"image(13).png","uploaded":1,"url":"\/ckfinder\/userfiles\/files\/image(13).png","error":{"number":201,"message":"A file with the same name is already available. The uploaded file was renamed to \"image(13).png\"."}} @upload.save respond_to do |format| format.json { render plain: {fileName: @upload.file.filename, uploaded: 1, url: @upload.file.url}.to_json } end end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/ckpages/uploads_controller.rb', line 6 def index @uploads = Upload.page(params[:page]) end |
#show ⇒ Object
10 11 12 |
# File 'app/controllers/ckpages/uploads_controller.rb', line 10 def show @upload = Upload.find(params[:id]) end |