Class: Api::V1::ContactPurposesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Api::V1::ContactPurposesController
- Defined in:
- app/controllers/api/v1/contact_purposes_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/api/v1/contact_purposes_controller.rb', line 5 def index contact_purposes = if params[:ids].present? [ContactPurpose.where(id: params[:ids])] else ContactPurpose.all end render json: {success: true, contact_purposes: contact_purposes.collect(&:to_data_hash)} end |
#show ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/api/v1/contact_purposes_controller.rb', line 16 def show contact_purpose = ContactPurpose.find(params[:id]) render json: {success: true, contact_purpose: contact_purpose.to_data_hash} end |