class Admin::AnnonceAccountRibsController < ApplicationController
  layout "admin"
  

  
  def index
    
    @annonce_account_ribs = AnnonceAccountRib.order("created_at DESC").all
  end


  def show

    @annonce_account_rib = AnnonceAccountRib.find(params[:id])
    send_file @annonce_account_rib.scan_file.path, :disposition => (params[:inline] ? "inline" : "attachment") if @annonce_account_rib.scan_file?

    
  end
  
  def valid
    @annonce_account_rib = AnnonceAccountRib.find(params[:id])
    
    @annonce_account_rib.validated = true
    @annonce_account_rib.validated_at = Time.now
    
    @annonce_account_rib.save
    
    #redirect_to :back
    
  end

  def edit
    @annonce_account_rib = AnnonceAccountRib.find(params[:id])
  end


  def update
    @annonce_account_rib = AnnonceAccountRib.find(params[:id])
    
    if @annonce_account_rib.update_attributes(params.require(:annonce_account_rib).permit!)

          
    else
      render :action => "edit" 
    end
    
  end

end
