Class: Administrate::Page::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/administrate/page/base.rb

Direct Known Subclasses

Collection, Form, Show

Instance Method Summary collapse

Constructor Details

#initialize(dashboard, options = {}) ⇒ Base

Returns a new instance of Base.



4
5
6
7
# File 'lib/administrate/page/base.rb', line 4

def initialize(dashboard, options = {})
  @dashboard = dashboard
  @options = options
end

Instance Method Details

#collection_includesObject



18
19
20
# File 'lib/administrate/page/base.rb', line 18

def collection_includes
  dashboard.try(:collection_includes) || []
end

#item_associationsObject



26
27
28
# File 'lib/administrate/page/base.rb', line 26

def item_associations
  dashboard.try(:item_associations) || []
end

#item_includesObject



22
23
24
# File 'lib/administrate/page/base.rb', line 22

def item_includes
  dashboard.try(:item_includes) || []
end

#resource_nameObject



9
10
11
12
# File 'lib/administrate/page/base.rb', line 9

def resource_name
  @resource_name ||=
    dashboard.class.to_s.scan(/(.+)Dashboard/).first.first.underscore
end

#resource_pathObject



14
15
16
# File 'lib/administrate/page/base.rb', line 14

def resource_path
  @resource_path ||= resource_name.tr("/", "_")
end