class Admin::StatsController

Public Instance Methods

stats() click to toggle source
# File lib/generators/happy_seed/admin/templates/app/controllers/admin/stats_controller.rb, line 4
def stats
  if params[:scope].blank?
    render :json => { :errors => "scope not set" }, :status => 422
  else
    cls = User
    cls = Identity.where( "provider = ?", "twitter" ) if params[:scope] == 'twitter_users'
    cls = Identity.where( "provider = ?", "instagram" ) if params[:scope] == 'instagram_users'
    ret = cls.group_by_month
    render json: ret
  end
end