Improve implementation to avoid N+1 database query
Move rails_12factor gem to production group

Fixes double logging in dev and DB debug output in test