Class: Locomotive::MembershipsController
Instance Method Summary
collapse
#current_site_public_url, #public_page_url
Instance Method Details
#create ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'app/controllers/locomotive/memberships_controller.rb', line 14
def create
authorize Membership
if @membership = service.create(membership_params[:email])
respond_with @membership, location: edit_current_site_path(current_site), flash: true
else
redirect_to new_account_path(email: membership_params[:email])
end
end
|
#destroy ⇒ Object
33
34
35
36
37
|
# File 'app/controllers/locomotive/memberships_controller.rb', line 33
def destroy
authorize @membership
@membership.destroy
respond_with @membership, location: edit_current_site_path
end
|
#edit ⇒ Object
23
24
25
|
# File 'app/controllers/locomotive/memberships_controller.rb', line 23
def edit
respond_with @membership
end
|
#new ⇒ Object
8
9
10
11
12
|
# File 'app/controllers/locomotive/memberships_controller.rb', line 8
def new
authorize Membership
@membership = current_site.memberships.build
respond_with @membership
end
|
#update ⇒ Object
27
28
29
30
31
|
# File 'app/controllers/locomotive/memberships_controller.rb', line 27
def update
authorize @membership
self.service.change_role(@membership, membership_params[:role])
respond_with @membership, location: edit_current_site_path
end
|