Module: Aerogel::Errors::Translated

Included in:
InvalidOperationError, NotFoundError
Defined in:
lib/aerogel/core/errors.rb

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/aerogel/core/errors.rb', line 5

def initialize( *args )
  @translation_key = nil
  if args.first.is_a? Symbol
    @translation_key = args.shift
  end
  super( *args )
end

#to_sObject



13
14
15
16
17
18
19
# File 'lib/aerogel/core/errors.rb', line 13

def to_s
  if @translation_key
    Aerogel::I18n.t @translation_key, scope: 'errors.messages'
  else
    super
  end
end