Sha256: 8d98238af83e50413799abbe879a004d56200b1a495227d5672ae4976596a182

Contents?: true

Size: 807 Bytes

Versions: 4

Compression:

Stored size: 807 Bytes

Contents

module PhotosManager
	class EventsController < ::ApplicationController

		before_filter :load_event, :except => [ :index, :new, :create]

		def index
			@events = Event.all
		end

		def show
			@photos = Kaminari.paginate_array(@event.photos).page(params[:page]).per(12)
		end
		
		def new
			@event = Event.new
		end
		
		def create
			@event = Event.new(params[:event])
			if @event.save
				redirect_to event_path(@event)
			else
				render :action => "new"
			end
		end
		
		def update
			if @event.update_attributes(params[:event])
				redirect_to event_path(@event)
			else
				render :action => 'edit'
			end
		end
		
		def destroy
			@event.destroy
			redirect_to events_path
		end
		
		def load_event
			@event = Event.find(params[:id])
		end
		
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
photos_manager-0.0.5 app/controllers/photos_manager/events_controller.rb
photos_manager-0.0.4 app/controllers/photos_manager/events_controller.rb
photos_manager-0.0.3 app/controllers/photos_manager/events_controller.rb
photos_manager-0.0.2 app/controllers/photos_manager/events_controller.rb