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

#association_includesObject



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

def association_includes
  dashboard.try(:association_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.gsub("/", "_")
end