Class: LesliVault::DescriptorsController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliVault::DescriptorsController
- Defined in:
- app/controllers/lesli_vault/descriptors_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /descriptors.
-
#destroy ⇒ Object
DELETE /descriptors/1.
-
#edit ⇒ Object
GET /descriptors/:id/edit.
-
#index ⇒ Object
GET /descriptors.
-
#list ⇒ Object
GET /descriptors/list.json.
-
#new ⇒ Object
GET /descriptors/new.
-
#show ⇒ Object
GET /descriptors/:id.
-
#update ⇒ Object
PATCH/PUT /descriptors/:id.
Instance Method Details
#create ⇒ Object
POST /descriptors
77 78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 77 def create descriptor = DescriptorService.new(current_user, query).create(descriptor_params) # Check if the creation went ok if descriptor.successful? respond_with_successful(descriptor) else respond_with_error(descriptor.errors) end end |
#destroy ⇒ Object
DELETE /descriptors/1
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 103 def destroy return respond_with_not_found unless @descriptor.found? @descriptor.destroy # Check if the deletion went ok unless @descriptor.successful? return respond_with_error(@descriptor.errors) end respond_with_successful end |
#edit ⇒ Object
GET /descriptors/:id/edit
73 74 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 73 def edit end |
#index ⇒ Object
GET /descriptors
48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 48 def index respond_to do |format| format.html {} format.json do #respond_with_successful(DescriptorService.new(current_user, query).index) respond_with_pagination(DescriptorService.new(current_user, query).index) end end end |
#list ⇒ Object
GET /descriptors/list.json
38 39 40 41 42 43 44 45 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 38 def list respond_to do |format| format.html {} format.json do respond_with_successful(DescriptorService.new(current_user, query).list) end end end |
#new ⇒ Object
GET /descriptors/new
69 70 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 69 def new end |
#show ⇒ Object
GET /descriptors/:id
59 60 61 62 63 64 65 66 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 59 def show respond_to do |format| format.html {} format.json do respond_with_successful(@descriptor.show) end end end |
#update ⇒ Object
PATCH/PUT /descriptors/:id
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/controllers/lesli_vault/descriptors_controller.rb', line 89 def update return respond_with_not_found unless @descriptor.found? @descriptor.update(descriptor_params) # Check if the update went ok unless @descriptor.successful? return respond_with_error(@descriptor.errors) end respond_with_successful(@descriptor.result) end |