Class: Services::MdsPullAccountsController
- Inherits:
-
ServiceBaseController
- Object
- ActionController::Base
- ApplicationController
- ServiceBaseController
- Services::MdsPullAccountsController
- Includes:
- StatusMasking
- Defined in:
- app/controllers/services/mds_pull_accounts_controller.rb
Constant Summary
Constants included from StatusMasking
StatusMasking::NEGATE_MASK, StatusMasking::STATUS_MASK
Constants inherited from ApplicationController
ApplicationController::MAX_LIST_LENGTH
Instance Attribute Summary collapse
-
#configured_account ⇒ Object
readonly
Returns the value of attribute configured_account.
-
#service_definition ⇒ Object
readonly
Returns the value of attribute service_definition.
Attributes inherited from ServiceBaseController
Instance Method Summary collapse
Methods included from StatusMasking
Instance Attribute Details
#configured_account ⇒ Object (readonly)
Returns the value of attribute configured_account.
6 7 8 |
# File 'app/controllers/services/mds_pull_accounts_controller.rb', line 6 def configured_account @configured_account end |
#service_definition ⇒ Object (readonly)
Returns the value of attribute service_definition.
6 7 8 |
# File 'app/controllers/services/mds_pull_accounts_controller.rb', line 6 def service_definition @service_definition end |
Instance Method Details
#index ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/services/mds_pull_accounts_controller.rb', line 11 def index status, operator = determine_status_operator(params[:status]) if configured_account.present? @mds_pull_accounts = configured_account.mds_pull_accounts. order("created_at DESC"). limit(MAX_LIST_LENGTH) elsif service_definition.present? @mds_pull_accounts = MdsPullAccount. joins(:configured_account). where("services_configured_accounts.service_definition_id" => service_definition.id). order("created_at DESC"). limit(MAX_LIST_LENGTH) else @mds_pull_accounts = MdsPullAccount. joins(:configured_account, :service_definition). where("services_service_definitions.service_id" => service.id). order("created_at DESC"). limit(MAX_LIST_LENGTH) end @mds_pull_accounts = @mds_pull_accounts.where("status #{operator} ?", status).order("created_at DESC").limit(MAX_LIST_LENGTH) if status.present? end |