Class: ActiveRecordImporter::Import
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActiveRecordImporter::Import
- Extended by:
- Enumerize
- Defined in:
- lib/app/models/import.rb
Instance Attribute Summary collapse
-
#execute_on_create ⇒ Object
Returns the value of attribute execute_on_create.
Instance Method Summary collapse
- #batch_size ⇒ Object
-
#execute ⇒ Object
I’ll add import options in the next major release accepts_nested_attributes_for :import_options, allow_destroy: true.
- #execute! ⇒ Object
-
#failed_file_path ⇒ Object
Override this method if you have private permissions or you have private methods for reading/writing uploaded files.
-
#import_file ⇒ Object
Override this if you prefer have private permissions or you have private methods for reading files.
- #resource_class ⇒ Object
Instance Attribute Details
#execute_on_create ⇒ Object
Returns the value of attribute execute_on_create.
13 14 15 |
# File 'lib/app/models/import.rb', line 13 def execute_on_create @execute_on_create end |
Instance Method Details
#batch_size ⇒ Object
42 43 44 |
# File 'lib/app/models/import.rb', line 42 def batch_size super.to_i end |
#execute ⇒ Object
I’ll add import options in the next major release accepts_nested_attributes_for :import_options, allow_destroy: true
30 31 32 |
# File 'lib/app/models/import.rb', line 30 def execute resource_class.import!(object: self, execute: execute_on_create) end |
#execute! ⇒ Object
34 35 36 |
# File 'lib/app/models/import.rb', line 34 def execute! resource_class.import!(object: self, execute: true) end |
#failed_file_path ⇒ Object
Override this method if you have private permissions or you have private methods for reading/writing uploaded files
60 61 62 |
# File 'lib/app/models/import.rb', line 60 def failed_file_path local_path?(failed_file) ? failed_file.path : failed_file.url end |
#import_file ⇒ Object
Override this if you prefer have private permissions or you have private methods for reading files
51 52 53 |
# File 'lib/app/models/import.rb', line 51 def import_file local_path?(file) ? file.path : file.url end |
#resource_class ⇒ Object
38 39 40 |
# File 'lib/app/models/import.rb', line 38 def resource_class resource.safe_constantize end |