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



20
21
22
# File 'lib/rails_admin/adapters/mongoid/extension.rb', line 20

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

#safe_send(value) ⇒ Object



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

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