videos_controller.rb 832 Bytes
# Author - Igor Portela - igorportela.com | Copyright(c) 2013. All rights reserved.
#
# Author Igor Amorim - www.igoramorim.com
#
class VideosController < InheritedResources::Base
  respond_to :html, :xml, :json
  #before_filter :authenticate_user!


  def index
    @videos = Video.where(:user_id => current_user.id)

  end
  def create
      @video = Video.new(params[:video])
      @video.user = current_user
 
      create! {
        if params[:video][:window_size].present?
          redirect_to generate_path(:id => @video) and return 
        else
          redirect_to choice_path(:id => @video) and return
        end
      }
  end

  def destroy
      destroy! { redirect_to videos_path and return }
  end
 
  def update
      update! { redirect_to window_path(:id => @video, :closed_caption => 2) and return }
  end

end