class Admin::AnnoncePhotosController < ApplicationController layout "admin" def index @annonce_photos = AnnoncePhoto.where("moderated is null and deleted is null").all end def show @annonce_photo = AnnoncePhoto.find(params[:id]) send_file @annonce_photo.scan_file.path, :disposition => (params[:inline] ? "inline" : "attachment") if @annonce_photo.scan_file? end def edit @annonce_photo = AnnoncePhoto.find(params[:id]) end def update @annonce_photo = AnnoncePhoto.find(params[:id]) @annonce_photo.modo_at = Time.now if @annonce_photo.update_attributes(params.require(:annonce_photo).permit!) @annonce_photo.annonce_default_photo else render :action => "edit" end end end