Class: Api::V1::ContactPurposesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/v1/contact_purposes_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



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

#showObject



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