Class: VideosController

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

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/videos_controller.rb', line 16

def create
  @video = Video.new(params[:video])
  if @video.save
    flash[:notice] = "Successfully created video."
    redirect_to @video
  else
    render :action => 'new'
  end
end

#destroyObject



40
41
42
43
44
45
# File 'app/controllers/videos_controller.rb', line 40

def destroy
  @video = Video.find(params[:id])
  @video.destroy
  flash[:notice] = "Successfully destroyed video."
  redirect_to :back
end

#editObject



26
27
28
# File 'app/controllers/videos_controller.rb', line 26

def edit
  @video = Video.find(params[:id])
end

#indexObject



2
3
4
# File 'app/controllers/videos_controller.rb', line 2

def index
  @videos = Video.all
end

#newObject



10
11
12
13
14
# File 'app/controllers/videos_controller.rb', line 10

def new
  @index = Index.find(params[:index_id])
  @video = @index.videos.build(:priority => ((@index.assets.first.lowest_priority + 1) rescue 0))
  render :layout => false
end

#showObject



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

def show
  @video = Video.find(params[:id])
end

#updateObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/videos_controller.rb', line 30

def update
  @video = Video.find(params[:id])
  if @video.update_attributes(params[:video])
    flash[:notice] = "Successfully updated video."
    redirect_to :back
  else
    render :action => 'edit'
  end
end