Sha256: acdadc96c72254a358b48bee324e3eccad0be61284375a8de788f02d5dd8b7b3

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

module Agilib
	class DevicesController < ApplicationController
		if Agilib.rails4?
	  	before_action :get_devices
	  else
	  	before_filter :get_devices
	  end

	  def index
	    @devices = @get_devices
	    respond_with(@devices)
	  end

	  def show
	    @device = @get_devices.find(params[:id])
			respond_with(@device)
	  end

	  def new
	    @device = @get_devices.build
			respond_with(@device)
	  end

	  def edit
	    @device = @get_devices.find(params[:id])
	    respond_with(@device)
	  end

	  def create
	    if Agilib.rails4?
	    	@device = @get_devices.build(device_params)
	    else
	    	@device = @get_devices.build(params[:device])
	    end
			respond_with(@device)
	  end

	  def update
	    @device = @get_devices.find(params[:id])
	    if Agilib.rails4?
	    	@device.update(device_params)
	    else
	    	@device.update_attributes(params[:device])
	    end
			respond_with(@device)
	  end

	  def destroy
	    @device = @get_devices.find(params[:id])
	    @device.destroy
	    respond_with(@device)
	  end

	  private
	  def get_devices
	  	@get_devices = current_user.devices
	  end
	  def device_params
      params.require(:device).permit(:platform, :register)
    end
	end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
agilib-0.1.9 app/controllers/agilib/devices_controller.rb
agilib-0.1.8 app/controllers/agilib/devices_controller.rb
agilib-0.1.7 app/controllers/agilib/devices_controller.rb
agilib-0.1.6 app/controllers/agilib/devices_controller.rb
agilib-0.1.5 app/controllers/agilib/devices_controller.rb