Class: ImagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/images_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#createObject


23
24
25
26
27
28
29
30
# File 'app/controllers/images_controller.rb', line 23

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

#destroyObject


43
44
45
46
47
48
49
# File 'app/controllers/images_controller.rb', line 43

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

#editObject


32
33
# File 'app/controllers/images_controller.rb', line 32

def edit
end

#indexObject


5
6
7
8
9
10
11
# File 'app/controllers/images_controller.rb', line 5

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

#newObject


13
14
15
# File 'app/controllers/images_controller.rb', line 13

def new
  @image = Image.new
end

#showObject


17
18
19
20
21
# File 'app/controllers/images_controller.rb', line 17

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

#updateObject


35
36
37
38
39
40
41
# File 'app/controllers/images_controller.rb', line 35

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