Module: DefaultErrorContainer

Extended by:
ActiveSupport::Concern
Included in:
AccountFindOrCreateService, AddOnServices::DuplicateAddOnService, Admin::RestaurantsController, AdminSettingUpdater, Agents::CreateBookingForOwner, BigGroupChecker, Bistrochat::Availabilities::Timetable, Bistrochat::Blockages::Create, Bistrochat::Blockages::Detail, Bistrochat::Blockages::Update, Bistrochat::Reservations::Cancel, Bistrochat::Reservations::Create, Bistrochat::Reservations::Detail, Bistrochat::Reservations::Update, Bistrochat::Restaurants::Detail, CancelReservationService, DeliveryChannel::CourierBase, DeliveryChannel::DistanceCalculator, DeliveryChannel::OrderManager, EmptyInventoryChecker, FavoriteRestaurantService, HhPackage::ReservationPackages::Validator, MarkReservationArrivedService, MarkReservationAsPaidService, MarkVoucherTransactionAsPaidService, MyActiveMerchants::Card, MyActiveMerchants::Gateway, MyActiveMerchants::VoucherGbPrimepayGateway, MyMenu::Availabilities::Timetable, MyMenu::Blockages::Create, MyMenu::Blockages::Detail, MyMenu::Blockages::Update, MyMenu::Reservations::Cancel, MyMenu::Reservations::Create, MyMenu::Reservations::Detail, MyMenu::Reservations::Update, MyMenu::Restaurants::Detail, OtpRequestService, PartnerService::Staff::CreateFromOwner, Payment::Gateway, PaymentProcessService::Cancelled, PaymentProcessService::MarkAsPaid, PendingTransactionService, PhoneVerificationService, Providers::GbPrimepay::CreditCard, Providers::VendorPayment, RefundGuaranteeClaimService, ReservationConfirmationService, ReservationService::Create, ReservationService::Form::Base, ReservationService::Init::HungryHub, RestaurantService::CreateBasic, RestaurantService::UpdateInventory, SevenRooms::Authentication, SevenRooms::Availabilities::Availability, SevenRooms::Blockages::Create, SevenRooms::Reservations::Cancel, SevenRooms::Reservations::Create, SevenRooms::Reservations::Detail, SevenRooms::Reservations::Update, SevenRooms::Restaurants::Detail, StaffService::ForgotPassword, StaffService::TemporaryAccess, Tablecheck::Availabilities::Timetable, Tablecheck::Blockages::Create, Tablecheck::Blockages::Detail, Tablecheck::Blockages::Update, Tablecheck::Reservations::Cancel, Tablecheck::Reservations::Create, Tablecheck::Reservations::Detail, Tablecheck::Reservations::Update, Tablecheck::Restaurants::Detail, TicketService::Form, TicketService::OldForm, TicketService::Redeem, TicketService::Transaction, Transactions::Reservation, Transactions::TicketTransaction, UserService::Delete, UserService::Update, Vendors::Bistrochat::BlockageWorker, Vendors::MyMenu::BlockageWorker, Vendors::Tablecheck::BlockageWorker, Vendors::Weeloy::BlockageWorker, VendorsService::GenerateMemoService, VendorsService::PaymentService, VendorsService::SupplierWebhookService, VendorsService::UpdateMemoService, VoucherForm::AppFirst, VoucherForm::Apply, VoucherForm::Referral, VoucherForm::Reward, VoucherForm::Validation, VoucherService::Apply, VoucherService::CreateTransaction, VoucherService::Modify, VoucherService::Validation, Weeloy::Blockages::Create, Weeloy::Blockages::Detail, Weeloy::Blockages::Update, Weeloy::Reservations::Cancel, Weeloy::Reservations::Create, Weeloy::Reservations::Detail, Weeloy::Reservations::Update, Weeloy::Restaurants::Detail
Defined in:
app/my_lib/default_error_container.rb

Overview

This will generate #error method if there is no #error_container method exist

Instance Method Summary collapse

Instance Method Details

#errorObject Also known as: errors

use error.add(:base, message)



10
11
12
13
14
15
16
# File 'app/my_lib/default_error_container.rb', line 10

def error
  @error ||= if respond_to?(:error_container) && error_container.is_a?(ErrorContainer)
               error_container
             else
               ErrorContainer.new
             end
end

#error_message_simpleObject



24
25
26
# File 'app/my_lib/default_error_container.rb', line 24

def error_message_simple
  errors.full_messages.uniq.select(&:present?).to_sentence
end

#merge_errors(another_errors) ⇒ Object



18
19
20
# File 'app/my_lib/default_error_container.rb', line 18

def merge_errors(another_errors)
  errors.add(:base, another_errors.full_messages.uniq.select(&:present?).to_sentence)
end