Class: ServicesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/services_controller.rb', line 16

def create
  @service = Service.new(params[:service])
  if @service.save
    flash[:notice] = 'Successfully created service.'
    redirect_to @service
  else
    render :action => 'new'
  end
end

#destroyObject



40
41
42
43
44
45
# File 'app/controllers/services_controller.rb', line 40

def destroy
  @service = Service.find(params[:id])
  @service.destroy
  flash[:notice] = 'Successfully destroyed service.'
  redirect_to services_url
end

#editObject



26
27
28
# File 'app/controllers/services_controller.rb', line 26

def edit
  @service = Service.find(params[:id])
end

#indexObject



4
5
6
# File 'app/controllers/services_controller.rb', line 4

def index
  @services = Service.all
end

#newObject



12
13
14
# File 'app/controllers/services_controller.rb', line 12

def new
  @service = Service.new
end

#showObject



8
9
10
# File 'app/controllers/services_controller.rb', line 8

def show
  @service = Service.find(params[:id])
end

#updateObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/services_controller.rb', line 30

def update
  @service = Service.find(params[:id])
  if @service.update_attributes(params[:service])
    flash[:notice] = 'Successfully updated service.'
    redirect_to @service
  else
    render :action => 'edit'
  end
end