Class: PhotosManager::EventsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/photos_manager/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

#destroyObject



35
36
37
38
# File 'app/controllers/photos_manager/events_controller.rb', line 35

def destroy
	@event.destroy
	redirect_to events_path
end

#indexObject



6
7
8
# File 'app/controllers/photos_manager/events_controller.rb', line 6

def index
	@events = Event.all
end

#load_eventObject



40
41
42
# File 'app/controllers/photos_manager/events_controller.rb', line 40

def load_event
	@event = Event.find(params[:id])
end

#newObject



14
15
16
# File 'app/controllers/photos_manager/events_controller.rb', line 14

def new
	@event = Event.new
end

#showObject



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

#updateObject



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