summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-20 20:39:45 -0700
committermo khan <mo@mokhan.ca>2014-02-20 20:39:45 -0700
commitbd442141974a110a1647b01be919bf03de407ab9 (patch)
tree05e605937fdc0a58ac423f43305047e23b6f961d /app
parent9a094059fcb67a9f54ee73efbdecc2835a5fe0c6 (diff)
filter by license status and township
Diffstat (limited to 'app')
-rw-r--r--app/controllers/v1/company_licenses_controller.rb3
-rw-r--r--app/models/license_status.rb3
2 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/v1/company_licenses_controller.rb b/app/controllers/v1/company_licenses_controller.rb
index 06d2145..963423a 100644
--- a/app/controllers/v1/company_licenses_controller.rb
+++ b/app/controllers/v1/company_licenses_controller.rb
@@ -2,7 +2,8 @@ class V1::CompanyLicensesController < ApplicationController
before_filter :load_company
def index
- @active_licenses = @company.active_licenses
+ @active_licenses = @company.status(LicenseStatus::ACTIVE)
+ @active_licenses = @active_licenses.township(params[:township]) if params[:township].present?
render json: @active_licenses
end
diff --git a/app/models/license_status.rb b/app/models/license_status.rb
new file mode 100644
index 0000000..abe54b1
--- /dev/null
+++ b/app/models/license_status.rb
@@ -0,0 +1,3 @@
+module LicenseStatus
+ ACTIVE="active"
+end