Module: Mongoid::Document

Defined in:
lib/mumuki/classroom/models/concerns/extensions.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#as_json(options = {}) ⇒ Object



4
5
6
# File 'lib/mumuki/classroom/models/concerns/extensions.rb', line 4

def as_json(options = {})
  super(options).as_json(except: ['_id', :_id]).deep_compact.with_indifferent_access
end

#upsert_attributes(attrs) ⇒ Object



8
9
10
11
# File 'lib/mumuki/classroom/models/concerns/extensions.rb', line 8

def upsert_attributes(attrs)
  assign_attributes(attrs)
  upsert
end