Class: Workarea::Admin::DataFileViewModel
- Inherits:
-
ApplicationViewModel
- Object
- ApplicationViewModel
- Workarea::Admin::DataFileViewModel
- Defined in:
- app/view_models/workarea/admin/data_file_view_model.rb
Instance Method Summary collapse
Instance Method Details
#created_by ⇒ Object
12 13 14 15 |
# File 'app/view_models/workarea/admin/data_file_view_model.rb', line 12 def created_by return @created_by if defined?(@created_by) @created_by = User.find(created_by_id) rescue nil end |
#error_count ⇒ Object
17 18 19 20 21 |
# File 'app/view_models/workarea/admin/data_file_view_model.rb', line 17 def error_count return 0 unless model.respond_to?(:file_errors) file_errors.values.flat_map(&:values).count + (.present? ? 1 : 0) end |
#errors_with_line_numbers? ⇒ Boolean
23 24 25 |
# File 'app/view_models/workarea/admin/data_file_view_model.rb', line 23 def errors_with_line_numbers? file_type == 'csv' end |
#type ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/view_models/workarea/admin/data_file_view_model.rb', line 4 def type if model.class == DataFile::Import :import elsif model.class == DataFile::Export :export end end |