Class: PhotosManager::EventsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PhotosManager::EventsController
- Defined in:
- app/controllers/photos_manager/events_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #load_event ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/photos_manager/events_controller.rb', line 18 def create @event = Event.new(params[:event]) if @event.save redirect_to event_path(@event) else render :action => "new" end end |
#destroy ⇒ Object
35 36 37 38 |
# File 'app/controllers/photos_manager/events_controller.rb', line 35 def destroy @event.destroy redirect_to events_path end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/photos_manager/events_controller.rb', line 6 def index @events = Event.all end |
#load_event ⇒ Object
40 41 42 |
# File 'app/controllers/photos_manager/events_controller.rb', line 40 def load_event @event = Event.find(params[:id]) end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/photos_manager/events_controller.rb', line 14 def new @event = Event.new end |
#show ⇒ Object
10 11 12 |
# File 'app/controllers/photos_manager/events_controller.rb', line 10 def show @photos = Kaminari.paginate_array(@event.photos).page(params[:page]).per(12) end |
#update ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/photos_manager/events_controller.rb', line 27 def update if @event.update_attributes(params[:event]) redirect_to event_path(@event) else render :action => 'edit' end end |