Class: RailsAdminNestable::Configuration
- Inherits:
-
Object
- Object
- RailsAdminNestable::Configuration
- Defined in:
- lib/rails_admin_nestable/configuration.rb
Instance Method Summary collapse
-
#initialize(abstract_model) ⇒ Configuration
constructor
A new instance of Configuration.
- #list? ⇒ Boolean
- #options ⇒ Object
- #tree? ⇒ Boolean
Constructor Details
#initialize(abstract_model) ⇒ Configuration
Returns a new instance of Configuration.
4 5 6 |
# File 'lib/rails_admin_nestable/configuration.rb', line 4 def initialize(abstract_model) @abstract_model = abstract_model end |
Instance Method Details
#list? ⇒ Boolean
12 13 14 |
# File 'lib/rails_admin_nestable/configuration.rb', line 12 def list? list.present? && !tree? end |
#options ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/rails_admin_nestable/configuration.rb', line 16 def if tree? @nestable_options ||= (tree.class == Hash ? tree : {}) elsif list? @nestable_options ||= { position_field: :position, max_depth: 1 }.merge(list.class == Hash ? list : {}) end @nestable_options || {} end |
#tree? ⇒ Boolean
8 9 10 |
# File 'lib/rails_admin_nestable/configuration.rb', line 8 def tree? tree.present? end |