Class: EventsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- EventsController
- Defined in:
- lib/app/controllers/events_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 |
# File 'lib/app/controllers/events_controller.rb', line 21 def create @event = @calendar.events.create(params[:event]) flash[:notice] = "Event successfully created" if @event.save respond_with(@calendar, @event) end |
#destroy ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/app/controllers/events_controller.rb', line 33 def destroy @event = @calendar.events.find(params[:id]) @event.destroy respond_to do |format| format.html { redirect_to(calendars_events_url(@calendar, @event)) } format.xml { head :ok } end end |
#edit ⇒ Object
17 18 19 |
# File 'lib/app/controllers/events_controller.rb', line 17 def edit respond_with(@calendar, (@event = @calendar.events.find(params[:id]))) end |
#index ⇒ Object
5 6 7 |
# File 'lib/app/controllers/events_controller.rb', line 5 def index respond_with(@calendar, (@events = @calendar.events.all)) end |
#new ⇒ Object
13 14 15 |
# File 'lib/app/controllers/events_controller.rb', line 13 def new respond_with(@calendar, (@event = @calendar.events.new)) end |
#show ⇒ Object
9 10 11 |
# File 'lib/app/controllers/events_controller.rb', line 9 def show respond_with(@calendar, (@event = @calendar.events.find(params[:id]))) end |
#update ⇒ Object
27 28 29 30 31 |
# File 'lib/app/controllers/events_controller.rb', line 27 def update @event = @calendar.events.find(params[:id]) @event.update_attributes(params[:calendar]) respond_with(@calendar, @event) end |