Class: LendingPoliciesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/lending_policies_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /lending_policies POST /lending_policies.json



46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/lending_policies_controller.rb', line 46

def create
  respond_to do |format|
    if @lending_policy.save
      format.html { redirect_to @lending_policy, notice: t('controller.successfully_created', model: t('activerecord.models.lending_policy')) }
      format.json { render json: @lending_policy, status: :created, location: @lending_policy }
    else
      prepare_options
      format.html { render action: "new" }
      format.json { render json: @lending_policy.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /lending_policies/1 DELETE /lending_policies/1.json



76
77
78
79
80
81
82
83
# File 'app/controllers/lending_policies_controller.rb', line 76

def destroy
  @lending_policy.destroy

  respond_to do |format|
    format.html { redirect_to lending_policies_url }
    format.json { head :no_content }
  end
end

#editObject

GET /lending_policies/1/edit



41
42
# File 'app/controllers/lending_policies_controller.rb', line 41

def edit
end

#indexObject

GET /lending_policies GET /lending_policies.json



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/lending_policies_controller.rb', line 9

def index
  if @item
    @lending_policies = @item.lending_policies.page(params[:page])
  else
    @lending_policies = LendingPolicy.page(params[:page])
  end

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @lending_policies }
  end
end

#newObject

GET /lending_policies/new GET /lending_policies/new.json



33
34
35
36
37
38
# File 'app/controllers/lending_policies_controller.rb', line 33

def new
  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @lending_policy }
  end
end

#showObject

GET /lending_policies/1 GET /lending_policies/1.json



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

def show
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @lending_policy }
  end
end

#updateObject

PUT /lending_policies/1 PUT /lending_policies/1.json



61
62
63
64
65
66
67
68
69
70
71
72
# File 'app/controllers/lending_policies_controller.rb', line 61

def update
  respond_to do |format|
    if @lending_policy.update(lending_policy_params)
      format.html { redirect_to @lending_policy, notice: t('controller.successfully_updated', model: t('activerecord.models.lending_policy')) }
      format.json { head :no_content }
    else
      prepare_options
      format.html { render action: "edit" }
      format.json { render json: @lending_policy.errors, status: :unprocessable_entity }
    end
  end
end