1 class MediaController < ApplicationController
3 # Make sure that a user logs in before doing any action here
4 before_filter :authorize
8 render :action => 'list'
11 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
12 verify :method => :post, :only => [ :destroy, :create, :update ],
13 :redirect_to => { :action => :list }
16 @media_pages, @medias = paginate :medias, :per_page => 10
20 @media = Media.find(params[:id])
28 @media = Media.new(params[:media])
30 flash[:notice] = 'Media was successfully created.'
31 redirect_to :action => 'list'
33 render :action => 'new'
38 @media = Media.find(params[:id])
42 @media = Media.find(params[:id])
43 if @media.update_attributes(params[:media])
44 flash[:notice] = 'Media was successfully updated.'
45 redirect_to :action => 'show', :id => @media
47 render :action => 'edit'
52 Media.find(params[:id]).destroy
53 redirect_to :action => 'list'