Class: NippoCore::ReportsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- NippoCore::ReportsController
- Includes:
- Pundit
- Defined in:
- app/controllers/nippo_core/reports_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#index ⇒ Object
TODO: Implement test.
- #new ⇒ Object
- #show ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/nippo_core/reports_controller.rb', line 21 def create @report if @report.save redirect_to group_reports_path(group_id: @group.id) else render 'new', status: 400 end end |
#index ⇒ Object
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 |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/nippo_core/reports_controller.rb', line 17 def new @report end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/nippo_core/reports_controller.rb', line 13 def show @report end |