summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-21 23:43:42 -0700
committermo khan <mo@mokhan.ca>2014-02-21 23:43:42 -0700
commit39fc3e184c1c185ffc9fc1f17bd19c5a8d9d0106 (patch)
tree47d42ae9531bae3d10cbea6a4b7eca5e7430c5f1 /app/controllers
parent18e3102f4e64d206c72efb28bbe7021b1ba09a16 (diff)
move search filter method from controller down to model.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/v1/company_licenses_controller.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/app/controllers/v1/company_licenses_controller.rb b/app/controllers/v1/company_licenses_controller.rb
index 234345c..3b4850f 100644
--- a/app/controllers/v1/company_licenses_controller.rb
+++ b/app/controllers/v1/company_licenses_controller.rb
@@ -2,7 +2,7 @@ class V1::CompanyLicensesController < ApplicationController
before_filter :load_company
def index
- @active_licenses = filter_using(@company, search_filters)
+ @active_licenses = @company.filter_licenses_using(search_filters)
render json: @active_licenses
end
@@ -12,12 +12,6 @@ class V1::CompanyLicensesController < ApplicationController
{ status: LicenseStatus.find_match(params[:status]), township: params[:township] }
end
- def filter_using(scope, filters)
- result = scope
- filters.each { |key, value| result = result.public_send(key, value) if value.present? }
- result
- end
-
def load_company
@company = Company.find(params[:company_id])
end