class VideasController < ApplicationController
  # GET /videas
  # GET /videas.json
  def index
    @videas = Videa.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @videas }
    end
  end

  # GET /videas/1
  # GET /videas/1.json
  def show
    @videa = Videa.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @videa }
    end
  end

  # GET /videas/new
  # GET /videas/new.json
  def new
    @videa = Videa.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @videa }
    end
  end

  # GET /videas/1/edit
  def edit
    @videa = Videa.find(params[:id])
  end

  # POST /videas
  # POST /videas.json
  def create
    @videa = Videa.new(params[:videa])

    respond_to do |format|
      if @videa.save
        format.html { redirect_to @videa, notice: 'Videa was successfully created.' }
        format.json { render json: @videa, status: :created, location: @videa }
      else
        format.html { render action: "new" }
        format.json { render json: @videa.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /videas/1
  # PUT /videas/1.json
  def update
    @videa = Videa.find(params[:id])

    respond_to do |format|
      if @videa.update_attributes(params[:videa])
        format.html { redirect_to @videa, notice: 'Videa was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @videa.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /videas/1
  # DELETE /videas/1.json
  def destroy
    @videa = Videa.find(params[:id])
    @videa.destroy

    respond_to do |format|
      format.html { redirect_to videas_url }
      format.json { head :no_content }
    end
  end
end
