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



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

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



48
49
50
51
# File 'app/controllers/plug/site_notices_controller.rb', line 48

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

#editObject

GET /site_notices/1/edit



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

def edit; end

#indexObject

GET /site_notices



12
13
14
# File 'app/controllers/plug/site_notices_controller.rb', line 12

def index
  @site_notices = SiteNotice.all
end

#newObject

GET /site_notices/new



20
21
22
# File 'app/controllers/plug/site_notices_controller.rb', line 20

def new
  @site_notice = SiteNotice.new
end

#updateObject

PATCH/PUT /site_notices/1



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

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