Class: Plug::SiteNoticesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/plug/site_notices_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /site_notices



26
27
28
29
30
31
32
33
34
# File 'app/controllers/plug/site_notices_controller.rb', line 26

def create
  @site_notice = SiteNotice.new(site_notice_params)

  if @site_notice.save
    redirect_to site_notices_path, notice: 'Site Notice was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /site_notices/1



46
47
48
49
# File 'app/controllers/plug/site_notices_controller.rb', line 46

def destroy
  @site_notice.destroy
  redirect_to site_notices_url, notice: 'Site Notice was successfully destroyed.'
end

#editObject

GET /site_notices/1/edit



23
# File 'app/controllers/plug/site_notices_controller.rb', line 23

def edit; end

#indexObject

GET /site_notices



10
11
12
# File 'app/controllers/plug/site_notices_controller.rb', line 10

def index
  @site_notices = SiteNotice.all
end

#newObject

GET /site_notices/new



18
19
20
# File 'app/controllers/plug/site_notices_controller.rb', line 18

def new
  @site_notice = SiteNotice.new
end

#updateObject

PATCH/PUT /site_notices/1



37
38
39
40
41
42
43
# File 'app/controllers/plug/site_notices_controller.rb', line 37

def update
  if @site_notice.update(site_notice_params)
    redirect_to site_notices_path, notice: 'Site Notice was successfully updated.'
  else
    render :edit
  end
end