Class: RailsAdminImport::Config::LegacyModel
- Inherits:
-
Object
- Object
- RailsAdminImport::Config::LegacyModel
- Defined in:
- lib/rails_admin_import/config/legacy_model.rb
Instance Attribute Summary collapse
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
Instance Method Summary collapse
- #excluded_fields(values) ⇒ Object
- #extra_fields(values) ⇒ Object
-
#initialize(model_name) ⇒ LegacyModel
constructor
A new instance of LegacyModel.
- #label(_value) ⇒ Object
- #mapping_key(value) ⇒ Object
Constructor Details
#initialize(model_name) ⇒ LegacyModel
Returns a new instance of LegacyModel.
5 6 7 |
# File 'lib/rails_admin_import/config/legacy_model.rb', line 5 def initialize(model_name) @model_name = model_name end |
Instance Attribute Details
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
4 5 6 |
# File 'lib/rails_admin_import/config/legacy_model.rb', line 4 def model_name @model_name end |
Instance Method Details
#excluded_fields(values) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rails_admin_import/config/legacy_model.rb', line 19 def excluded_fields(values) config = RailsAdmin.config(model_name) # Call appropriate Rails Admin field list methods config.import do include_all_fields exclude_fields *values end end |
#extra_fields(values) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rails_admin_import/config/legacy_model.rb', line 29 def extra_fields(values) config = RailsAdmin.config(model_name) # Call appropriate Rails Admin field list methods config.import do include_all_fields values.each do |value| field value end end end |
#label(_value) ⇒ Object
9 10 11 12 |
# File 'lib/rails_admin_import/config/legacy_model.rb', line 9 def label(_value) # Ignored now # RailsAdmin object_label_method will be used end |
#mapping_key(value) ⇒ Object
14 15 16 17 |
# File 'lib/rails_admin_import/config/legacy_model.rb', line 14 def mapping_key(value) config = RailsAdmin.config(model_name) config.mapping_key(value) end |