Class: ActiveAdmin::Resource

Inherits:
Object
  • Object
show all
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

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, options = {})
  @belongs_to = Resource::BelongsTo.new(self, target, options)
  self.sub_navigation_menu_name = target
  controller.send :belongs_to, target, options.dup
end

#has_nested_resources?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


19
20
21
# File 'lib/active_admin/subnav/extensions/resource.rb', line 19

def show_sub_menu?(action)
  sub_menu_item? || (has_nested_resources? && ["show", "edit"].include?(action))
end