Class: Mdm::CommandsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Mdm::CommandsController
- Defined in:
- app/controllers/mdm/commands_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/mdm/commands_controller.rb', line 17 def create @commands = create_commands(devices) @commands.each { |command| command.device.notify } render json: @commands rescue NoMethodError render json: { error: 'wrong command' }, status: :bad_request rescue ArgumentError render json: { error: 'bad arguments' }, status: :bad_request rescue ActiveRecord::RecordNotFound render nothing: true, status: :not_found end |