metamaps--metamaps/app/controllers/main_controller.rb
Connor Turland 86a6e92bc3 dont show private maps in global collection (#734)
* dont show private maps in global collection

* Update explore_controller.rb

* Update main_controller.rb
2016-10-06 23:45:17 -04:00

30 lines
634 B
Ruby

# frozen_string_literal: true
class MainController < ApplicationController
before_action :authorize_main
after_action :verify_authorized
# GET /
def home
respond_to do |format|
format.html do
if authenticated?
@maps = policy_scope(Map).where.not(name: 'Untitled Map').where.not(permission: 'private')
.order(updated_at: :desc).page(1).per(20)
render 'explore/active'
else
render 'main/home'
end
end
end
end
# GET /request
def requestinvite
end
private
def authorize_main
authorize :Main
end
end