Class: DocContract::ContractTemplatesController
Instance Method Summary
collapse
#pdf, #processed_html, #processed_markdown
#main
Instance Method Details
#create ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 21
def create
@record = record_class.new record_params
authorize! :create, @record
if @record.save
redirect_to @record, status: :see_other
else
render action: 'new'
end
end
|
#destroy ⇒ Object
51
52
53
54
55
56
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 51
def destroy
@record = record_class.find params[:id]
authorize! :destroy, @record
@record.destroy
redirect_to record_class, status: :see_other
end
|
#edit ⇒ Object
36
37
38
39
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 36
def edit
@record = record_class.find(params[:id])
authorize! :edit, @record
end
|
#index ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 8
def index
authorize! :index, record_class
@q = record_class.ransack query
@q.sorts = 'name asc' if @q.sorts.empty?
@records = @q.result.page(params[:page]).per(100)
respond_with(@records)
end
|
#new ⇒ Object
16
17
18
19
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 16
def new
@record = record_class.new
authorize! :create, @record
end
|
#show ⇒ Object
31
32
33
34
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 31
def show
@record = record_class.find params[:id]
authorize! :show, @record
end
|
#update ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/doc_contract/contract_templates_controller.rb', line 41
def update
@record = record_class.find params[:id]
authorize! :edit, @record
if @record.update record_params
redirect_to @record, status: :see_other
else
render action: 'edit'
end
end
|