Module: RailsAdmin::Adapters::Mongoid::Extension

Extended by:
ActiveSupport::Concern
Defined in:
lib/rails_admin/adapters/mongoid/extension.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#rails_admin_default_object_label_methodObject


18
19
20
# File 'lib/rails_admin/adapters/mongoid/extension.rb', line 18

def rails_admin_default_object_label_method
  self.new_record? ? "new #{self.class}" : "#{self.class} ##{id}"
end

#safe_send(value) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/rails_admin/adapters/mongoid/extension.rb', line 22

def safe_send(value)
  if attributes.detect { |k, _v| k.to_s == value.to_s }
    read_attribute(value)
  else
    send(value)
  end
end