Class: Locomotive::MembershipsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/memberships_controller.rb

Instance Method Summary collapse

Methods included from ActionController::Ssl

#require_ssl

Methods included from ActionController::UrlHelpers

#current_site_public_url, #public_page_url, #switch_to_site_url

Methods included from ActionController::SectionHelpers

#sections

Methods included from ActionController::LocaleHelpers

#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/locomotive/memberships_controller.rb', line 6

def create
  @membership = current_site.memberships.build(params[:membership])
  @membership.role = 'author' # force author by default

  case @membership.process!
  when :create_account
    redirect_to (email: @membership.email)
  when :save_it
    respond_with @membership, location: edit_current_site_path
  when :error
    respond_with @membership, flash: true
  when :already_created
    respond_with @membership, alert: t('flash.locomotive.memberships.create.already_created'), location: edit_current_site_path
  end
end

#destroyObject



22
23
24
25
26
# File 'app/controllers/locomotive/memberships_controller.rb', line 22

def destroy
  @membership = current_site.memberships.find(params[:id])
  @membership.destroy
  respond_with @membership, location: edit_current_site_path
end