Class: Naf::JanitorialAssignmentsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



29
30
31
32
33
34
35
36
37
# File 'app/controllers/naf/janitorial_assignments_controller.rb', line 29

def create
  @janitorial_assignment = janitorial_assignment_type.new(params[params_name])
  if  @janitorial_assignment.save
    redirect_to(@janitorial_assignment,
                notice: "#{@janitorial_assignment.type} '#{@janitorial_assignment.model_name}' was successfully created.")
  else
    render action: "new"
  end
end

#editObject



39
40
41
# File 'app/controllers/naf/janitorial_assignments_controller.rb', line 39

def edit
  @janitorial_assignment = janitorial_assignment_type.find(params[:id])
end

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/naf/janitorial_assignments_controller.rb', line 6

def index
  @params_name = params_name
  @rows =
  if params[:deleted].nil? || params[:deleted] == "false"
    janitorial_assignment_type.where(deleted: false).order("id desc")
  else
    janitorial_assignment_type.order("id desc")
  end
  respond_to do |format|
    format.js
    format.html
  end
end

#newObject



25
26
27
# File 'app/controllers/naf/janitorial_assignments_controller.rb', line 25

def new
  @janitorial_assignment = janitorial_assignment_type.new
end

#showObject



20
21
22
23
# File 'app/controllers/naf/janitorial_assignments_controller.rb', line 20

def show
  @record = janitorial_assignment_type.find(params[:id])
  render template: 'naf/record'
end

#updateObject



43
44
45
46
47
48
49
50
51
# File 'app/controllers/naf/janitorial_assignments_controller.rb', line 43

def update
  @janitorial_assignment = janitorial_assignment_type.find(params[:id])
  if @janitorial_assignment.update_attributes(params[params_name])
    redirect_to(@janitorial_assignment,
                notice: "#{@janitorial_assignment.type} '#{@janitorial_assignment.model_name}' was successfully updated.")
  else
    render action: "edit"
  end
end