Class: Papercat::Api::BaseController
Instance Method Summary
collapse
#admin
Instance Method Details
#create ⇒ Object
24
25
26
27
28
|
# File 'app/controllers/papercat/api/base_controller.rb', line 24
def create
@record = model.new(model_params)
@record.save
respond_with(@record, location: record_path)
end
|
#destroy ⇒ Object
35
36
37
38
|
# File 'app/controllers/papercat/api/base_controller.rb', line 35
def destroy
@record.destroy
respond_with(@record, location: collection_path)
end
|
#index ⇒ Object
16
17
18
|
# File 'app/controllers/papercat/api/base_controller.rb', line 16
def index
respond_with(@collection, location: collection_path)
end
|
#show ⇒ Object
20
21
22
|
# File 'app/controllers/papercat/api/base_controller.rb', line 20
def show
respond_with(@record, location: record_path)
end
|
#update ⇒ Object
30
31
32
33
|
# File 'app/controllers/papercat/api/base_controller.rb', line 30
def update
@record.update(model_params)
respond_with(@record, location: record_path)
end
|