Class: Groseillier::AdministratorsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/groseillier/administrators_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



25
26
27
28
29
30
# File 'app/controllers/groseillier/administrators_controller.rb', line 25

def create
  @administrator = Administrator.new(params[:administrator])
  @administrator.save

  respond_with @administrator
end

#destroyObject



41
42
43
44
45
46
# File 'app/controllers/groseillier/administrators_controller.rb', line 41

def destroy
  @administrator = Administrator.find(params[:id])
  @administrator.destroy

  respond_with @administrator
end

#editObject



21
22
23
# File 'app/controllers/groseillier/administrators_controller.rb', line 21

def edit
  @administrator = Administrator.find(params[:id])
end

#indexObject



3
4
5
6
7
# File 'app/controllers/groseillier/administrators_controller.rb', line 3

def index
  @administrators = Administrator.scoped

  respond_with @administrator
end

#newObject



15
16
17
18
19
# File 'app/controllers/groseillier/administrators_controller.rb', line 15

def new
  @administrator = Administrator.new

  respond_with(@administrator)
end

#showObject



9
10
11
12
13
# File 'app/controllers/groseillier/administrators_controller.rb', line 9

def show
  @administrator = Administrator.find(params[:id])

  respond_with @administrator
end

#updateObject



32
33
34
35
36
37
38
39
# File 'app/controllers/groseillier/administrators_controller.rb', line 32

def update
  @administrator = Administrator.find(params[:id])
  params[:administrator].delete(:password) if params[:administrator][:password].blank?
  params[:administrator].delete(:password_confirmation) if params[:administrator][:password_confirmation].blank?

  @administrator.update_attributes(params[:administrator])
  respond_with @administrator
end