Commit 6dd29f3e by Ivan Lan

change variable name

parent aff26d23
...@@ -29,13 +29,13 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -29,13 +29,13 @@ class SimpleController::BaseController < ::InheritedResources::Base
end end
def upload_excel def upload_excel
excel = import_class.import_excel_klass.new excel = importable_class.import_excel_klass.new
excel.load(params[:file]) excel.load(params[:file])
render json: { uid: excel.uid } render json: { uid: excel.uid }
end end
def excel def excel
excel = import_class.import_excel_klass.new(params[:uid]) excel = importable_class.import_excel_klass.new(params[:uid])
pagination = excel.records_pagination(page: params[:page] || 1, per_page: params[:per_page] || 15) pagination = excel.records_pagination(page: params[:page] || 1, per_page: params[:per_page] || 15)
render json: { render json: {
current_page: pagination.current_page, current_page: pagination.current_page,
...@@ -47,13 +47,13 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -47,13 +47,13 @@ class SimpleController::BaseController < ::InheritedResources::Base
end end
def import def import
xlsx_file = params[:file] || import_class.import_excel_klass.new(params[:uid]) xlsx_file = params[:file] || importable_class.import_excel_klass.new(params[:uid])
response = import_class.import_xlsx(xlsx_file, collection, **params.to_unsafe_h) response = importable_class.import_xlsx(xlsx_file, collection, **params.to_unsafe_h)
render json: response, status: 201 render json: response, status: 201
end end
def export def export
url = export_class.export_xlsx collection, params.to_unsafe_h url = exportable_class.export_xlsx collection, params.to_unsafe_h
render json: { url: url }, status: 201 render json: { url: url }, status: 201
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment