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

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

Instance Method Summary collapse

Instance Method Details

#rails_admin_default_object_label_methodObject



13
14
15
# File 'lib/rails_admin/adapters/mongoid/extension.rb', line 13

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



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

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