Module: RailsAdminImport::Config
- Defined in:
- lib/rails_admin_import/config.rb,
lib/rails_admin_import/config/legacy_model.rb
Defined Under Namespace
Classes: LegacyModel
Constant Summary collapse
- HEADER_CONVERTER =
Default is to downcase headers and add underscores to convert into attribute names
lambda do |header| header.parameterize.underscore end
Class Attribute Summary collapse
-
.csv_options ⇒ Object
Returns the value of attribute csv_options.
-
.header_converter ⇒ Object
Returns the value of attribute header_converter.
-
.line_item_limit ⇒ Object
Returns the value of attribute line_item_limit.
-
.logging ⇒ Object
Returns the value of attribute logging.
-
.rollback_on_error ⇒ Object
Returns the value of attribute rollback_on_error.
Class Method Summary collapse
- .model(model_name, &block) ⇒ Object
-
.reset ⇒ Object
Reset all configurations to defaults.
Class Attribute Details
.csv_options ⇒ Object
Returns the value of attribute csv_options.
10 11 12 |
# File 'lib/rails_admin_import/config.rb', line 10 def @csv_options end |
.header_converter ⇒ Object
Returns the value of attribute header_converter.
9 10 11 |
# File 'lib/rails_admin_import/config.rb', line 9 def header_converter @header_converter end |
.line_item_limit ⇒ Object
Returns the value of attribute line_item_limit.
7 8 9 |
# File 'lib/rails_admin_import/config.rb', line 7 def line_item_limit @line_item_limit end |
.logging ⇒ Object
Returns the value of attribute logging.
6 7 8 |
# File 'lib/rails_admin_import/config.rb', line 6 def logging @logging end |
.rollback_on_error ⇒ Object
Returns the value of attribute rollback_on_error.
8 9 10 |
# File 'lib/rails_admin_import/config.rb', line 8 def rollback_on_error @rollback_on_error end |
Class Method Details
.model(model_name, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rails_admin_import/config.rb', line 17 def model(model_name, &block) unless @deprecation_shown warn "RailsAdminImport::Config#model is deprecated. " \ "Add a import section for your model inside the rails_admin " \ "config block. See the Readme.md for more details" @deprecation_shown = true end legacy_config = RailsAdminImport::Config::LegacyModel.new(model_name) legacy_config.instance_eval(&block) if block legacy_config end |
.reset ⇒ Object
Reset all configurations to defaults.
30 31 32 33 34 35 36 |
# File 'lib/rails_admin_import/config.rb', line 30 def reset @logging = false @line_item_limit = 1000 @rollback_on_error = false @header_converter = HEADER_CONVERTER @csv_options = {} end |