Sha256: 6a4bb44888c1d5709d8ddaafccc01bc5a3ba46ed0e1f2de603c813d5cf4ed600
Contents?: true
Size: 1.61 KB
Versions: 4
Compression:
Stored size: 1.61 KB
Contents
require_dependency "extface/application_controller" module Extface class DevicesController < ApplicationController before_action :set_device, only: [:show, :edit, :update, :destroy] # GET /devices def index @devices = extfaceable.extface_devices.load end # GET /devices/1 def show end # GET /devices/new def new @device = extfaceable.extface_devices.new render action: :form end # GET /devices/1/edit def edit render action: :form end # POST /devices def create @device = extfaceable.extface_devices.new(device_params) if @device.save redirect_to @device, notice: 'Device was successfully created.' else render action: :form end end # PATCH/PUT /devices/1 def update if @device.update(device_params) redirect_to @device, notice: 'Device was successfully updated.' else render action: :form end end # DELETE /devices/1 def destroy @device.destroy redirect_to devices_url, notice: 'Device was successfully destroyed.' end def test_page set_device @job = @device.driveable.print_test_page if params[:test_page] render action: :show end private # Use callbacks to share common setup or constraints between actions. def set_device @device = extfaceable.extface_devices.find(params[:id]) end # Only allow a trusted parameter "white list" through. def device_params params.require(:device).permit(:uuid, :name, :driver, :driveable_id, :driveable_type) end end end
Version data entries
4 entries across 4 versions & 1 rubygems