Class: V1::HouseholdsController
- Inherits:
-
ApiController
- Object
- ApiController
- V1::HouseholdsController
- Defined in:
- api/app/api/v1/households_controller.rb
Overview
Manage Households
Class Method Summary collapse
-
.household_params(params) ⇒ Object
def update household = policy_scope(Household).find(params[:id]) authorize household, :update? Household.transaction do household.update_attributes!(self.class.household_params) if params[:subject_ids] && params[:subject_ids].any? household.subject_ids = policy_scope(Subject).where(id: params[:subject_ids]).pluck(:id) end end expose household, serializer: V1::HouseholdSerializer end.
Instance Method Summary collapse
-
#household_for_subject ⇒ Object
Look up a household for a particular subject.
-
#search ⇒ Object
Search households.
-
#show ⇒ Object
Show a household.
Class Method Details
.household_params(params) ⇒ Object
def update household = policy_scope(Household).find(params[:id]) authorize household, :update? Household.transaction do household.update_attributes!(self.class.household_params) if params[:subject_ids] && params[:subject_ids].any? household.subject_ids = policy_scope(Subject).where(id: params[:subject_ids]).pluck(:id) end end expose household, serializer: V1::HouseholdSerializer end
Instance Method Details
#household_for_subject ⇒ Object
#search ⇒ Object
Search households. Unfortunately this one is still a POST because of constraints of a clientside library we used at the time of writing this end point.
#show ⇒ Object
Show a household
Options
- [Integer] id