Class: LesliBell::AnnouncementsController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliBell::AnnouncementsController
- Defined in:
- app/controllers/lesli_bell/announcements_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /announcements.
-
#destroy ⇒ Object
DELETE /announcements/1.
-
#edit ⇒ Object
GET /announcements/1/edit.
-
#index ⇒ Object
GET /announcements.
-
#new ⇒ Object
GET /announcements/new.
-
#show ⇒ Object
GET /announcements/1.
-
#update ⇒ Object
PATCH/PUT /announcements/1.
Instance Method Details
#create ⇒ Object
POST /announcements
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 24 def create @announcement = Announcement.new(announcement_params) if @announcement.save redirect_to @announcement, notice: "Announcement was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /announcements/1
44 45 46 47 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 44 def destroy @announcement.destroy redirect_to announcements_url, notice: "Announcement was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /announcements/1/edit
20 21 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /announcements
6 7 8 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 6 def index @announcements = Announcement.all end |
#new ⇒ Object
GET /announcements/new
15 16 17 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 15 def new @announcement = Announcement.new end |
#show ⇒ Object
GET /announcements/1
11 12 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /announcements/1
35 36 37 38 39 40 41 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 35 def update if @announcement.update(announcement_params) redirect_to @announcement, notice: "Announcement was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |