Class: SimpleWallet::Service

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/services/simple_wallet/service.rb

Instance Method Summary collapse

Instance Method Details

#errors_sentenceObject



5
6
7
# File 'app/services/simple_wallet/service.rb', line 5

def errors_sentence
  errors.full_messages.to_sentence
end

#t(key, **options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/services/simple_wallet/service.rb', line 11

def t(key, **options)
  if key.to_s.first == "."
    path = self.class.name.underscore.tr("/", ".")
    parent_class_path = self.class.superclass.name.underscore.tr("/", ".")
    defaults = [ :"#{path}#{key}", :"#{parent_class_path}#{key}" ]
    defaults << options[:default] if options[:default]
    options[:default] = defaults.flatten
    key = "#{path}#{key}"
  end

  options[:raise] = (Rails.env.development? || Rails.env.test?)
  I18n.t(key, **options)
end