Class: Workarea::BulkAction::SequentialProductEdit
- Inherits:
-
Workarea::BulkAction
- Object
- Workarea::BulkAction
- Workarea::BulkAction::SequentialProductEdit
- Defined in:
- app/models/workarea/bulk_action/sequential_product_edit.rb
Instance Method Summary collapse
-
#act_on!(product) ⇒ Object
It’s ok to override here, since this BulkAction doesn’t really have a chunk of work to do for each product - it’s up to the administrator.
-
#find_product(index) ⇒ Object
Good god is this gnarly, but the amount of code to do this better would be very large.
Methods inherited from Workarea::BulkAction
#admin_query, #completed!, #completed?, #convert_query_to_ids, #perform!, #reset_to_default!
Methods included from ApplicationDocument
Methods included from Sidekiq::Callbacks
add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list
Methods included from Mongoid::Document
Instance Method Details
#act_on!(product) ⇒ Object
It’s ok to override here, since this BulkAction doesn’t really have a chunk of work to do for each product - it’s up to the administrator.
14 15 16 17 18 |
# File 'app/models/workarea/bulk_action/sequential_product_edit.rb', line 14 def act_on!(product) @current_index ||= 0 throw :matching_index, product if @current_index == @seeking_index @current_index += 1 end |
#find_product(index) ⇒ Object
Good god is this gnarly, but the amount of code to do this better would be very large.
6 7 8 9 10 |
# File 'app/models/workarea/bulk_action/sequential_product_edit.rb', line 6 def find_product(index) @current_index = 0 @seeking_index = index.to_i catch(:matching_index) { perform! } end |