Class: Socializer::GroupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Socializer::GroupsController
- Defined in:
- app/controllers/socializer/groups_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #joinable ⇒ Object
- #memberships ⇒ Object
- #new ⇒ Object
- #ownerships ⇒ Object
- #pending_invites ⇒ Object
- #public ⇒ Object
- #restricted ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/socializer/groups_controller.rb', line 41 def create @group = current_user.groups.build(params[:group]) if @group.save redirect_to @group else render :new end end |
#destroy ⇒ Object
59 60 61 62 |
# File 'app/controllers/socializer/groups_controller.rb', line 59 def destroy @group.destroy redirect_to groups_path end |
#edit ⇒ Object
51 52 |
# File 'app/controllers/socializer/groups_controller.rb', line 51 def edit end |
#index ⇒ Object
5 6 |
# File 'app/controllers/socializer/groups_controller.rb', line 5 def index end |
#joinable ⇒ Object
16 17 18 |
# File 'app/controllers/socializer/groups_controller.rb', line 16 def joinable @groups = Socializer::Group.joinable end |
#memberships ⇒ Object
20 21 22 |
# File 'app/controllers/socializer/groups_controller.rb', line 20 def memberships @memberships = current_user.memberships end |
#new ⇒ Object
37 38 39 |
# File 'app/controllers/socializer/groups_controller.rb', line 37 def new @group = Group.new end |
#ownerships ⇒ Object
24 25 26 |
# File 'app/controllers/socializer/groups_controller.rb', line 24 def ownerships @ownerships = current_user.groups end |
#pending_invites ⇒ Object
28 29 30 |
# File 'app/controllers/socializer/groups_controller.rb', line 28 def pending_invites @pending_invites = current_user.pending_memberships_invites end |
#public ⇒ Object
8 9 10 |
# File 'app/controllers/socializer/groups_controller.rb', line 8 def public @groups = Socializer::Group.public end |
#restricted ⇒ Object
12 13 14 |
# File 'app/controllers/socializer/groups_controller.rb', line 12 def restricted @groups = Socializer::Group.restricted end |
#show ⇒ Object
32 33 34 35 |
# File 'app/controllers/socializer/groups_controller.rb', line 32 def show @group = Group.find(params[:id]) @membership = Membership.find_by(group_id: @group.id) end |
#update ⇒ Object
54 55 56 57 |
# File 'app/controllers/socializer/groups_controller.rb', line 54 def update @group.update!(params[:group]) redirect_to @group end |