Class: SpreeCmCommissioner::VotingContestants::BulkUpdater
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::VotingContestants::BulkUpdater
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/voting_contestants/bulk_updater.rb
Constant Summary collapse
- ALLOWED_ADVANCED_TO_TYPES =
%w[ SpreeCmCommissioner::VotingSession SpreeCmCommissioner::ShowEpisode ].freeze
Instance Method Summary collapse
Instance Method Details
#call(voting_session:, updates:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/spree_cm_commissioner/voting_contestants/bulk_updater.rb', line 11 def call(voting_session:, updates:) @voting_session = voting_session @updates = updates || {} @errors = [] ActiveRecord::Base.transaction do process_updates raise ActiveRecord::Rollback if @errors.any? end if @errors.empty? success(voting_session: @voting_session) else failure(nil, @errors.to_sentence) end rescue StandardError => e failure(nil, e.) end |