Class: ActiveAdmin::Comment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/activeadmin-poro-decorator/comment.rb

Class Method Summary collapse

Class Method Details

.resource_type(resource) ⇒ String

Returns The name of the record to use for the polymorphic relationship.

Returns:

  • (String)

    The name of the record to use for the polymorphic relationship



4
5
6
7
8
9
10
11
12
13
# File 'lib/activeadmin-poro-decorator/comment.rb', line 4

def self.resource_type(resource)
  # original method has 
  # ResourceController::Decorators.undecorate(resource).class.base_class.name.to_s
  # here, but somehow it didn't work
  undecorated = ResourceController::Decorators.undecorate(resource)
  if undecorated.to_s.include?(':')
    undecorated = undecorated.class.to_s
  end
  undecorated.to_s
end