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.to_s}" : "#{self.class.to_s} ##{self.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 self.attributes.find{ |k,v| k.to_s == value.to_s }
    self.read_attribute(value)
  else
    self.send(value)
  end
end