Class: ActiveAdmin::Resource
- Inherits:
-
Object
- Object
- ActiveAdmin::Resource
- Defined in:
- lib/active_admin/subnav/extensions/resource.rb,
lib/active_admin/subnav/extensions/resource_menu.rb
Defined Under Namespace
Modules: Menu
Instance Method Summary collapse
-
#belongs_to(target, options = {}) ⇒ Object
TODO: Support for optional belongs_to.
- #has_nested_resources? ⇒ Boolean
- #nested_resources=(value) ⇒ Object
- #show_sub_menu?(action) ⇒ Boolean
Instance Method Details
#belongs_to(target, options = {}) ⇒ Object
TODO: Support for optional belongs_to
5 6 7 8 9 |
# File 'lib/active_admin/subnav/extensions/resource.rb', line 5 def belongs_to(target, = {}) @belongs_to = Resource::BelongsTo.new(self, target, ) self. = target controller.send :belongs_to, target, .dup end |
#has_nested_resources? ⇒ Boolean
15 16 17 |
# File 'lib/active_admin/subnav/extensions/resource.rb', line 15 def has_nested_resources? @nested_resources end |
#nested_resources=(value) ⇒ Object
11 12 13 |
# File 'lib/active_admin/subnav/extensions/resource.rb', line 11 def nested_resources=(value) @nested_resources = value end |
#show_sub_menu?(action) ⇒ Boolean
19 20 21 |
# File 'lib/active_admin/subnav/extensions/resource.rb', line 19 def (action) || (has_nested_resources? && ["show", "edit"].include?(action)) end |