Popular protips Mailer

Create new search with a mailer to send a monthly email highlighting the popular protips for the past month.
Okay. :/

Sent from my iPhone

> On Aug 26, 2014, at 3:54 PM, Abdelkader Boudih <notifications@github.com> wrote:
> 
> In app/mailers/protip_mailer.rb:
> 
> > +
> > +  def teams_for_user(user)
> > +    Team.most_relevant_featured_for(user).select do |team|
> > +      team.hiring?
> > +    end
> > +  end
> > +
> > +  module Queries
> > +    def self.popular_protips(from, to)
> > +      search_results = ProtipMailer::Queries.search_for_popular_protips(from, to)
> > +      public_ids = search_results.map { |protip| protip['public_id'] }
> > +
> > +      Protip.eager_load(:user, :comments).where('public_id in (?)', public_ids)
> > +    end
> > +
> > +    def self.search_for_popular_protips(from, to, max_results=10)
> Tire handle many cases such as server error . Also the same hash that will work on Tire will work on the ES Model , so we must use that.
> 
> —
> Reply to this email directly or view it on GitHub.