Class: Assetable::ExternalServicesController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Assetable::ExternalServicesController
- Defined in:
- app/controllers/assetable/external_services_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Create a new external service asset.
-
#new ⇒ Object
New template.
-
#permitted_params ⇒ Object
Permitted params for the model.
Instance Method Details
#create ⇒ Object
Create a new external service asset
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/assetable/external_services_controller.rb', line 16 def create @external_service = ExternalService.new(permitted_params) if @external_service.errors.empty? and @external_service.save render json: { success: true, html: render_to_string(partial: "assetable/assets/asset", locals: { asset: @external_service, fieldname: params[:fieldname]})} else puts "errors:: #{@external_service.errors.}" render json: { status: "error", errors: @external_service.errors., html: render_to_string(:new) } end end |
#new ⇒ Object
New template
11 12 13 |
# File 'app/controllers/assetable/external_services_controller.rb', line 11 def new @external_service = ExternalService.new end |
#permitted_params ⇒ Object
Permitted params for the model
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/assetable/external_services_controller.rb', line 28 def permitted_params params.require(:external_service).permit( :name, :filename, :body, :content_type, :width, :height ) end |