Class: ImpExp::Serializers::Errors::RecordNotFound
- Defined in:
- app/services/imp_exp/serializers/errors/record_not_found.rb
Instance Attribute Summary collapse
-
#active_record_class ⇒ Object
readonly
Returns the value of attribute active_record_class.
-
#find_args ⇒ Object
readonly
Returns the value of attribute find_args.
Instance Method Summary collapse
-
#initialize(active_record_class, find_args) ⇒ RecordNotFound
constructor
A new instance of RecordNotFound.
- #message ⇒ Object
Constructor Details
#initialize(active_record_class, find_args) ⇒ RecordNotFound
Returns a new instance of RecordNotFound.
9 10 11 12 13 14 |
# File 'app/services/imp_exp/serializers/errors/record_not_found.rb', line 9 def initialize(active_record_class, find_args) super() @active_record_class = active_record_class @active_record_class = @active_record_class.constantize if @active_record_class.is_a?(String) @find_args = find_args&.symbolize_keys end |
Instance Attribute Details
#active_record_class ⇒ Object (readonly)
Returns the value of attribute active_record_class.
7 8 9 |
# File 'app/services/imp_exp/serializers/errors/record_not_found.rb', line 7 def active_record_class @active_record_class end |
#find_args ⇒ Object (readonly)
Returns the value of attribute find_args.
7 8 9 |
# File 'app/services/imp_exp/serializers/errors/record_not_found.rb', line 7 def find_args @find_args end |
Instance Method Details
#message ⇒ Object
16 17 18 19 20 |
# File 'app/services/imp_exp/serializers/errors/record_not_found.rb', line 16 def conditions = find_args.map { |k, v| "#{k}=#{v}" }.join(' ') I18n.t('imp_exp.importer.record_not_found', model_name: active_record_class.model_name, conditions: conditions) end |