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



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

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

#safe_send(value) ⇒ Object



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

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