app/controllers/jobs_controller.rb
# allow turning on and off of public jobs
allow turning on and off of public jobs
allow turning on and off of public jobs
def toggle_public
    @job = Job.find(params[:id])
    if !check_user(@job)
      flash[:alert] =  'Job not available'
      redirect_to :controller => '/jobs', :action => 'show', :id => @job.id and return
    else 
      @job.public = !@job.public
      if @job.save
        Rails.logger.error("SAVE succeeded")
        flash[:notice] = "Job #{@job.id} public status changed"
        redirect_to :controller => '/jobs', :action => 'show', :id => @job.id
      else
        Rails.logger.error("SAVE failed")
        flash[:alert] = "Job #{@job.id} public status not changed"
        redirect_to :controller => '/jobs', :action => 'show', :id => @job.id
      end
    end
  end
def toggle_public @job = Job . find ( params [ :id ] ) if ! check_user ( @job ) flash [ :alert ] = 'Job not available' redirect_to :controller => '/jobs' , :action => 'show' , :id => @job . id and return else @job . public = ! @job . public if @job . save Rails . logger . error ( "SAVE succeeded" ) flash [ :notice ] = "Job #{@job.id} public status changed" redirect_to :controller => '/jobs' , :action => 'show' , :id => @job . id else Rails . logger . error ( "SAVE failed" ) flash [ :alert ] = "Job #{@job.id} public status not changed" redirect_to :controller => '/jobs' , :action => 'show' , :id => @job . id end end end
allow turning on and off of public jobs
allow turning on and off of public jobs