Class: Hippo::API::GenericController
Instance Attribute Summary
#data, #model, #params
Instance Method Summary
collapse
#initialize
#json_status_str, #record_active_record_errors, #records_for_reply, #std_api_reply
Instance Method Details
#create ⇒ Object
11
12
13
14
15
|
# File 'lib/hippo/api/generic_controller.rb', line 11
def create
record = model.from_attribute_data(data, current_user)
options = build_reply_options.merge(success: record.save)
std_api_reply(:create, record, options)
end
|
#destroy ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/hippo/api/generic_controller.rb', line 25
def destroy
if params[:id]
perform_single_destroy
elsif data.is_a?(Array)
perform_multiple_destroy
end
end
|
#show ⇒ Object
7
8
9
|
# File 'lib/hippo/api/generic_controller.rb', line 7
def show
perform_retrieval
end
|
#update ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/hippo/api/generic_controller.rb', line 17
def update
if params[:id]
perform_single_update
elsif data.is_a?(Array)
perform_multiple_updates
end
end
|