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.
-
#list ⇒ Object
GET /announcements/list.
-
#new ⇒ Object
GET /announcements/new.
-
#show ⇒ Object
GET /announcements/1.
-
#update ⇒ Object
PATCH/PUT /announcements/1.
Instance Method Details
#create ⇒ Object
POST /announcements
39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 39 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
59 60 61 62 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 59 def destroy @announcement.destroy redirect_to announcements_url, notice: "Announcement was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /announcements/1/edit
35 36 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 35 def edit end |
#index ⇒ Object
GET /announcements
16 17 18 19 20 21 22 23 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 16 def index respond_to do |format| format.html { } format.json { respond_with_pagination(AnnouncementService.new(current_user, query).index) } end end |
#list ⇒ Object
GET /announcements/list
6 7 8 9 10 11 12 13 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 6 def list respond_to do |format| format.html { } format.json { respond_with_pagination(AnnouncementService.new(current_user, query).list) } end end |
#new ⇒ Object
GET /announcements/new
30 31 32 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 30 def new @announcement = Announcement.new end |
#show ⇒ Object
GET /announcements/1
26 27 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 26 def show end |
#update ⇒ Object
PATCH/PUT /announcements/1
50 51 52 53 54 55 56 |
# File 'app/controllers/lesli_bell/announcements_controller.rb', line 50 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 |