Class: VideosController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- VideosController
- Defined in:
- app/controllers/videos_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
26 27 28 |
# File 'app/controllers/videos_controller.rb', line 26 def edit @video = Video.find(params[:id]) end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/videos_controller.rb', line 2 def index @videos = Video.all end |
#new ⇒ Object
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 |
#show ⇒ Object
6 7 8 |
# File 'app/controllers/videos_controller.rb', line 6 def show @video = Video.find(params[:id]) end |
#update ⇒ Object
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 |