Class: NippoCore::ReportsController

Inherits:
ApplicationController show all
Includes:
Pundit
Defined in:
app/controllers/nippo_core/reports_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
# File 'app/controllers/nippo_core/reports_controller.rb', line 21

def create
  authorize @report
  if @report.save
    redirect_to group_reports_path(group_id: @group.id)
  else
    render 'new', status: 400
  end
end

#indexObject

TODO: Implement test



8
9
10
11
# File 'app/controllers/nippo_core/reports_controller.rb', line 8

def index
  redirect_to home_path unless @group.member?(current_user)
  @reports = @group.reports.order(reported_at: :desc).page(params[:page]).per(10)
end

#newObject



17
18
19
# File 'app/controllers/nippo_core/reports_controller.rb', line 17

def new
  authorize @report
end

#showObject



13
14
15
# File 'app/controllers/nippo_core/reports_controller.rb', line 13

def show
  authorize @report
end