Class: BrickLayer::AdministratorsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/brick_layer/administrators_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#authenticate, #current_administrator

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/brick_layer/administrators_controller.rb', line 14

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

  if @administrator.save
    flash[:success] = "You Created a New Administrator!"
    redirect_to administrators_path
  else
    render "new"
  end
end

#destroyObject



34
35
36
37
38
# File 'app/controllers/brick_layer/administrators_controller.rb', line 34

def destroy
  @administrator.destroy
  flash[:success] = "Administrator Removed!"
  redirect_to administrators_path
end

#indexObject



6
7
8
# File 'app/controllers/brick_layer/administrators_controller.rb', line 6

def index
  @administrators = BrickLayer::Administrator.all
end

#newObject



10
11
12
# File 'app/controllers/brick_layer/administrators_controller.rb', line 10

def new
  @administrator = BrickLayer::Administrator.new
end

#updateObject



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

def update
  if @administrator.update_attributes(params[:administrator])
    flash[:success] = "Administrator Updated!"
    redirect_to administrators_path
  else
    render "edit"
  end
end