oddlyzen
9/27/2012 - 12:55 AM

OfficeGames Root Path Constraint

OfficeGames Root Path Constraint

class AuthConstraint
  def matches?(request)
    request.session['user_id'].present?
  end
end

Officegames::Application.routes.draw do
  constraints(AuthConstraint.new) do
    root :to => 'games#index'
  end

  root :to => 'registrations#new'
end