Class: DateBook::CalendarsController
- Inherits:
-
DateBookController
- Object
- ApplicationController
- DateBookController
- DateBook::CalendarsController
- Defined in:
- app/controllers/date_book/calendars_controller.rb
Overview
Allows viewing and maintaining Calendars
Instance Method Summary collapse
-
#create ⇒ Object
POST /calendars.
-
#destroy ⇒ Object
DELETE /calendars/slug.
-
#edit ⇒ Object
GET /calendars/slug/edit.
-
#index ⇒ Object
GET /calendars.
-
#new ⇒ Object
GET /calendars/new.
-
#show ⇒ Object
GET /calendars/slug.
-
#update ⇒ Object
PATCH/PUT /calendars/slug.
Instance Method Details
#create ⇒ Object
POST /calendars
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/date_book/calendars_controller.rb', line 21 def create @calendar.owners = [current_user] unless @calendar.save flash[:error] = @calendar.errors..to_sentence render :new return end redirect_to(@calendar, notice: :item_acted_on.l( item: Calendar.model_name.human, action: :created.l )) end |
#destroy ⇒ Object
DELETE /calendars/slug
48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/date_book/calendars_controller.rb', line 48 def destroy @calendar.destroy redirect_to( calendars_url, notice: :item_acted_on.l( item: Calendar.model_name.human, action: :destroyed.l ) ) end |
#edit ⇒ Object
GET /calendars/slug/edit
18 |
# File 'app/controllers/date_book/calendars_controller.rb', line 18 def edit; end |
#index ⇒ Object
GET /calendars
9 |
# File 'app/controllers/date_book/calendars_controller.rb', line 9 def index; end |
#new ⇒ Object
GET /calendars/new
15 |
# File 'app/controllers/date_book/calendars_controller.rb', line 15 def new; end |
#show ⇒ Object
GET /calendars/slug
12 |
# File 'app/controllers/date_book/calendars_controller.rb', line 12 def show; end |
#update ⇒ Object
PATCH/PUT /calendars/slug
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/date_book/calendars_controller.rb', line 35 def update unless @calendar.update(calendar_params) flash[:error] = @calendar.errors..to_sentence render :edit return end redirect_to(@calendar, notice: :item_acted_on.l( item: Calendar.model_name.human, action: :updated.l )) end |