Class: SimpleTeams::MembershipsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SimpleTeams::MembershipsController
- Defined in:
- app/controllers/simple_teams/memberships_controller.rb,
app/controllers/simple_teams/admin/memberships_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /memberships.
-
#destroy ⇒ Object
DELETE /memberships/1.
-
#edit ⇒ Object
GET /memberships/1/edit.
-
#index ⇒ Object
GET /memberships.
-
#new ⇒ Object
GET /memberships/new.
-
#show ⇒ Object
GET /memberships/1.
-
#update ⇒ Object
PATCH/PUT /memberships/1.
Instance Method Details
#create ⇒ Object
POST /memberships
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 24 def create @membership = Membership.new(membership_params) if @membership.save redirect_to @membership, notice: "Membership was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /memberships/1
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 44 def destroy :destroy, @membership member_id = @membership.member.id member_name = @membership.member.full_name recipients = @team.members.to_a @membership.destroy SimpleTeams::Memberships::DestroyedNotification.with( :team_id => @team.id, :member_id => member_id, :user_id => current_user.id, :team_name => @team.name, :member_name => member_name, :user_name => current_user.full_name ).deliver_later(recipients) redirect_to team_path(@team) end |
#edit ⇒ Object
GET /memberships/1/edit
20 21 22 23 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 20 def edit :edit, @membership @service_object = SimpleTeams::MembershipForm.new(@membership, current_user) end |
#index ⇒ Object
GET /memberships
6 7 8 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 6 def index @memberships = Membership.all end |
#new ⇒ Object
GET /memberships/new
15 16 17 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 15 def new @membership = Membership.new end |
#show ⇒ Object
GET /memberships/1
11 12 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /memberships/1
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/simple_teams/admin/memberships_controller.rb', line 35 def update :edit, @membership @service_object = SimpleTeams::MembershipForm.new(@membership, current_user) respond_to do |format| if @service_object.perform(service_object_params) format.html { redirect_to team_path(@team), notice: "Membership was updated successfully." } format.json { render :show, status: :created, location: @service_object.membership } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @service_object.errors, status: :unprocessable_entity } end end end |