Class: Portfolio::Admin::SitesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/portfolio/admin/sites_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/portfolio/admin/sites_controller.rb', line 18

def create
  @site = Site.new(item_params)

  respond_to do |format|
    if @site.save
      format.html { redirect_to show_portfolio_path(@site.key), notice: 'Site was successfully created.' }
    else
      format.html { render :new }
    end
  end
end

#destroyObject



40
41
42
43
44
45
# File 'app/controllers/portfolio/admin/sites_controller.rb', line 40

def destroy
  @site.destroy
  respond_to do |format|
    format.html { redirect_to [:admin, :sites], notice: 'Site was successfully destroyed.' }
  end
end

#editObject



15
16
# File 'app/controllers/portfolio/admin/sites_controller.rb', line 15

def edit
end

#indexObject



7
8
9
# File 'app/controllers/portfolio/admin/sites_controller.rb', line 7

def index
  @sites = Site.all
end

#newObject



11
12
13
# File 'app/controllers/portfolio/admin/sites_controller.rb', line 11

def new
  @site = Site.new
end

#updateObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/portfolio/admin/sites_controller.rb', line 30

def update
  respond_to do |format|
    if @site.update(item_params)
      format.html { redirect_to show_portfolio_path(@site.key), notice: 'Site was successfully updated.' }
    else
      format.html { render :edit }
    end
  end
end