Class: EducodeSales::CommonsController
Instance Method Summary
collapse
#authenticate_admin, #authenticate_request, #current_user, #filter, #is_commissioner_above?, #paginate, #render_failure, #render_success, #subject_members, #subject_staffs, #subject_url
#add_businesses_score, #base_url, #collection_amount_score, #completion_rate, #current?, #disk_filename, #get_businesses_chart, #handled_data, #handled_time_data, #handled_time_data_accurate, #relative_path, #signed_amount_score, #storage_path, #url_to_avatar, #visits_score
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'app/controllers/educode_sales/commons_controller.rb', line 16
def create
common = Common.new(name: params[:name], clazz: params[:clazz])
if common.save
render_success
else
render_failure common
end
end
|
#edit ⇒ Object
25
26
27
28
|
# File 'app/controllers/educode_sales/commons_controller.rb', line 25
def edit
@common = Common.find(params[:id])
render layout: false
end
|
#index ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'app/controllers/educode_sales/commons_controller.rb', line 6
def index
respond_to do |format|
format.html do
end
format.json do
@commons = Common.group("clazz").page(params[:page]).per(params[:limit])
end
end
end
|
#new ⇒ Object
39
40
41
|
# File 'app/controllers/educode_sales/commons_controller.rb', line 39
def new
render layout: false
end
|
#show ⇒ Object
43
44
45
46
|
# File 'app/controllers/educode_sales/commons_controller.rb', line 43
def show
commons = Common.find(params[:id])
@commons = Common.where(clazz: commons.clazz).order('position')
end
|
#update ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'app/controllers/educode_sales/commons_controller.rb', line 30
def update
common = Common.find(params[:id])
if common.update(common_params)
render_success
else
render_failure common
end
end
|