class WinewooCore::Repositories::Mongo::CellarMongoRepo
Public Instance Methods
create(winewoo_user, entry_params)
click to toggle source
# File lib/winewoo_core/repositories/mongo/cellar_mongo_repo.rb, line 14 def create(winewoo_user, entry_params) winewoo_user.cellar_entries.create(entry_params) end
destroy(winewoo_user, entry_id)
click to toggle source
# File lib/winewoo_core/repositories/mongo/cellar_mongo_repo.rb, line 33 def destroy(winewoo_user, entry_id) entry = winewoo_user.cellar_entries.find(entry_id) entry.destroy if entry return entry end
find(winewoo_user, filters)
click to toggle source
# File lib/winewoo_core/repositories/mongo/cellar_mongo_repo.rb, line 4 def find(winewoo_user, filters) # TODO UNOFFICIALS # winewoo_user.cellar_entries.map do |entry| # wine = Wine.find entry.wine_id # entry if wine && wine.official? # end.reject(&:blank?) winewoo_user.cellar_entries end
update(winewoo_user, entry_id, entry_params)
click to toggle source
# File lib/winewoo_core/repositories/mongo/cellar_mongo_repo.rb, line 19 def update(winewoo_user, entry_id, entry_params) entry = winewoo_user.cellar_entries.find(entry_id) # TODO UNOFFICIALS # if entry # wine = Wine.find entry.wine_id # entry = nil if wine && wine.unofficial? # end entry.update_attributes(entry_params) if entry return entry end