Class: XmlImport
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- XmlImport
- Defined in:
- app/models/xml_import.rb
Overview
Schema Information
Table name: xml_imports
id :integer not null, primary key
xml_import_type_id :integer default(1)
updated_count :integer default(0)
created_count :integer default(0)
created_at :datetime
updated_at :datetime
Instance Method Summary collapse
Instance Method Details
#kind ⇒ Object
28 29 30 |
# File 'app/models/xml_import.rb', line 28 def kind xml_import_type.title end |
#start ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/xml_import.rb', line 32 def start path = ( || AttachmentFile.where(guid: fileupload_guid).first).try(:data).try(:path) return nil if path.nil? response = case xml_import_type.code when :post then TranslationCms::Import::Post.start(path, self) when :sample then TranslationCms::Import::Sample.start(path, self) end update_column :updated_count, response.updated_count.to_i update_column :created_count, response.created_count.to_i end |
#title ⇒ Object
24 25 26 |
# File 'app/models/xml_import.rb', line 24 def title I18n.l(created_at, format: :long) end |