Class: Locomotive::Api::MembershipsController

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

Instance Method Summary collapse

Methods included from Locomotive::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



19
20
21
22
23
24
# File 'app/controllers/locomotive/api/memberships_controller.rb', line 19

def create
  @membership = current_site.memberships.new
  @membership.from_presenter(params[:membership].merge(:role => 'author')) # force author by default
  @membership.save
  respond_with(@membership)
end

#destroyObject



32
33
34
35
# File 'app/controllers/locomotive/api/memberships_controller.rb', line 32

def destroy
  @membership.destroy
  respond_with(@membership)
end

#indexObject



11
12
13
# File 'app/controllers/locomotive/api/memberships_controller.rb', line 11

def index
  respond_with(@memberships)
end

#showObject



15
16
17
# File 'app/controllers/locomotive/api/memberships_controller.rb', line 15

def show
  respond_with(@membership)
end

#updateObject



26
27
28
29
30
# File 'app/controllers/locomotive/api/memberships_controller.rb', line 26

def update
  @membership.from_presenter(params[:membership])
  @membership.save
  respond_with(@membership)
end