Class: Locomotive::SitesController

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

Instance Method Summary collapse

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



13
14
15
16
17
18
# File 'app/controllers/locomotive/sites_controller.rb', line 13

def create
  @site = Site.new(params[:site])
  @site.memberships.build :account => self., :role => 'admin'
  @site.save
  respond_with @site, :location => 
end

#destroyObject



20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/locomotive/sites_controller.rb', line 20

def destroy
  @site = self..sites.find(params[:id])

  if @site != current_site
    @site.destroy
  else
    @site.errors.add(:base, 'Can not destroy the site you are logging in now')
  end

  respond_with @site, :location => 
end

#newObject



8
9
10
11
# File 'app/controllers/locomotive/sites_controller.rb', line 8

def new
  @site = Site.new
  respond_with @site
end