osem-fcy/lib/root_route_constraint.rb
2017-04-01 13:45:36 +05:30

10 lines
302 B
Ruby

class RootRouteConstraint
def initialize
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
end
def matches?(*)
return unless @current.present? && @current.first.splashpage.present?
@current.count == 1 && @current.first.splashpage.public?
end
end