# Pastebin dTH99wYE filter = {} filter[:name] = name if name DB[:wallets].where(filter).select_hash_groups(:name, [:currency, :amount]).to_json