Module: DutwsFoo::Mongoid::ClassMethods

Defined in:
lib/dutws_foo/mongoid/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#insert(p_data) ⇒ Object



4
5
6
7
# File 'lib/dutws_foo/mongoid/class_methods.rb', line 4

def insert(p_data)
  data = p_data["Data"]
  self.create(data)
end

#remove(p_data) ⇒ Object



14
15
16
# File 'lib/dutws_foo/mongoid/class_methods.rb', line 14

def remove(p_data)
  self.where(:reference_id => p_data["ID"].to_i).first.destroy
end

#update(p_data) ⇒ Object



9
10
11
12
# File 'lib/dutws_foo/mongoid/class_methods.rb', line 9

def update(p_data)
  data = p_data["Data"]
  self.where(:reference_id => p_data["ID"].to_i).first.update_attributes(p_data["Data"])
end