Sha256: 5cead8b9bd107a9922a310fd02c6a3fa5381b4c89b8e6d749e344880b5f9a918

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

class ImagesController < ApplicationController
  before_filter :find_compute_resource
  before_filter :find_by_name, :except => [:index, :new, :create]

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

  def new
    @image = Image.new
  end

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

  def create
    @image = Image.new(params[:image])
    if @image.save
      process_success :success_redirect => compute_resource_path(@compute_resource)
    else
      process_error
    end
  end

  def edit
  end

  def update
    if @image.update_attributes(params[:image])
      process_success :success_redirect => compute_resource_path(@compute_resource)
    else
      process_error
    end
  end

  def destroy
    if @image.destroy
      process_success :success_redirect => compute_resource_path(@compute_resource)
    else
      process_error
    end
  end

  private

  def find_compute_resource
    @compute_resource = ComputeResource.find(params[:compute_resource_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/images_controller.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/controllers/images_controller.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/controllers/images_controller.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/controllers/images_controller.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/controllers/images_controller.rb