Class: NippoCore::GroupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- NippoCore::GroupsController
- Defined in:
- app/controllers/nippo_core/groups_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/nippo_core/groups_controller.rb', line 17 def create if @group.save @group.add_member(current_user) redirect_to root_path else render 'new', status: 400 end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/nippo_core/groups_controller.rb', line 5 def index @groups = NippoCore::Group.order(created_at: :desc).page(params[:page]).per(10) end |
#new ⇒ Object
9 10 |
# File 'app/controllers/nippo_core/groups_controller.rb', line 9 def new end |
#show ⇒ Object
12 13 14 15 |
# File 'app/controllers/nippo_core/groups_controller.rb', line 12 def show @group = NippoCore::Group.find(params[:id]) @reports = @group.reports.order(reported_at: :desc).limit(5) end |