Class: WinewooCore::Repositories::Mongo::GlobalWineDataMongoRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/winewoo_core/repositories/mongo/global_wine_data_mongo_repo.rb

Instance Method Summary collapse

Instance Method Details

#get(wine_data_id) ⇒ Object



4
5
6
7
8
# File 'lib/winewoo_core/repositories/mongo/global_wine_data_mongo_repo.rb', line 4

def get(wine_data_id)
  wine_data_id == 'first' ?
    GlobalWineData.first :
    (wine_data_id && GlobalWineData.find(wine_data_id))
end

#update(wine_data_id, data_params) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/winewoo_core/repositories/mongo/global_wine_data_mongo_repo.rb', line 11

def update(wine_data_id, data_params)
  return unless wine_data_id
  wine_data = GlobalWineData.find(wine_data_id)
  return unless wine_data
  wine_data.update_attributes(data_params)
  return wine_data
end