osem-fcy/lib/root_route_constraint.rb

11 lines
302 B
Ruby
Raw Normal View History

2017-02-11 16:45:27 +05:30
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