rtopitt/bolao2014

View on GitHub
app/controllers/bets_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class BetsController < ApplicationController

  # GET /bets
  # Via: bets_path
  def index
    @_bets = Bet.includes(:payment).order("points desc").all
    @bets = BetPresenter.map(@_bets)
    @paid_bets_count = @bets.select(&:paid?).size
    @paying_bets_count = @bets.select(&:paying?).size
  end

  # GET /bets/:id
  # Via: bet_path(:id)
  #
  # Shows a summary of the requested bet
  # TODO spec
  def show
    @_bet = Bet.find(params[:id])
    @bet = BetPresenter.new(@_bet)
  end

end