Module: Hirb::Views::MongoDb

Defined in:
lib/hirb/views/mongo_db.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#mongo_mapper__document_view(obj) ⇒ Object Also known as: mongo_mapper__embedded_document_view



9
10
11
12
13
# File 'lib/hirb/views/mongo_db.rb', line 9

def mongo_mapper__document_view(obj)
  fields = obj.class.column_names
  fields.delete('_id') && fields.unshift('_id')
  {:fields=>fields}
end

#mongoid__document_view(obj) ⇒ Object



2
3
4
5
6
7
# File 'lib/hirb/views/mongo_db.rb', line 2

def mongoid__document_view(obj)
  fields = obj.class.fields.keys
  fields.delete('_id')
  fields.unshift('_id')
  {:fields=>fields}
end