Class: MyTimeline::EventsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- MyTimeline::EventsController
- Defined in:
- app/controllers/my_timeline/events_controller.rb
Defined Under Namespace
Classes: DateWithEvents
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/my_timeline/events_controller.rb', line 34 def destroy @event = Event.find_by_id(params[:id]) @event.destroy redirect_to root_path end |
#edit ⇒ Object
21 22 23 |
# File 'app/controllers/my_timeline/events_controller.rb', line 21 def edit @event = Event.find_by_id params[:id] end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/my_timeline/events_controller.rb', line 4 def index if @show_hidden q = {} else q = {public: true} end @events = @user.events.where(q).desc.page params[:page] @events_by_day = @events.all.to_a.group_by { |e| e.happened_on.to_date } @dates_with_events = build_dates end |
#show ⇒ Object
17 18 19 |
# File 'app/controllers/my_timeline/events_controller.rb', line 17 def show # end |
#update ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/my_timeline/events_controller.rb', line 25 def update @event = Event.find_by_id params[:id] if @event.update_attributes(rails4? ? event_params : params[:event]) redirect_to root_path, notice: "Edit successful." else render 'edit' end end |