Class: InOrder::ListsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- InOrder::ListsController
- Includes:
- Concerns::ResponseHelpers
- Defined in:
- app/controllers/in_order/lists_controller.rb
Instance Method Summary collapse
Instance Method Details
#add ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/in_order/lists_controller.rb', line 32 def add update = InOrder::Update.new(keys) @elements = update.(record_keys, append: append_to_existing_list?, uniq: uniq?, max: max) respond_to_list http_status end |
#create ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/in_order/lists_controller.rb', line 12 def create @elements = InOrder::Create.new(keys).(record_keys) respond_to_list http_status(:created) end |
#destroy ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/controllers/in_order/lists_controller.rb', line 18 def destroy if element = InOrder::Element.find_by_id(params[:id]) delete_by_keys element.to_keys end respond_to_list http_status(:accepted), true end |
#index ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/in_order/lists_controller.rb', line 6 def index @elements = InOrder::Fetch.new(keys).elements respond_to_list end |
#remove ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/in_order/lists_controller.rb', line 26 def remove delete_by_keys keys respond_to_list http_status(:accepted), true end |