Sha256: 7b7426275e29d64a4863092633787d4ccc9c12778615c35c27bdd6afdccdb281

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

class PtablesController < ApplicationController
  include Foreman::Controller::AutoCompleteSearch
  before_filter :find_ptable, :only => %w{show edit update destroy}

  def index
    values = Ptable.search_for(params[:search], :order => params[:order])
    respond_to do |format|
      format.html { @ptables = values.paginate :page => params[:page], :include => [:operatingsystems] }
      format.json { render :json => values }
    end
  end

  def show
    respond_to do |format|
      format.json { render :json => @ptable }
    end
  end

  def new
    @ptable = Ptable.new
  end

  def create
    @ptable = Ptable.new(params[:ptable])
    if @ptable.save
      process_success
    else
      process_error
    end
  end

  def edit
  end

  def update
    if @ptable.update_attributes(params[:ptable])
      process_success
    else
      process_error
    end
  end

  def destroy
    if @ptable.destroy
      process_success
    else
      process_error
    end
  end

  private
  def find_ptable
    @ptable = Ptable.find(params[:id])
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/controllers/ptables_controller.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/controllers/ptables_controller.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/controllers/ptables_controller.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/controllers/ptables_controller.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/controllers/ptables_controller.rb