Sha256: d61cf3b9003f2f0142ed0175e18a0d9c0553751f50797216e28c5b5b5cf68637
Contents?: true
Size: 1.26 KB
Versions: 8
Compression:
Stored size: 1.26 KB
Contents
class LogviewsController < ApplicationController layout 'empty' active_scaffold :log do |config| config = self # Ruby19 compatibility config.list.sorting = { :id => :desc } # , :created_at => :desc config.list.columns = [:created_at, :content, :id] config.list.per_page = 20 #config.theme = :black end def upd s = Log.find(:last, :select => "id") s = s.id if s logger.debug "Latest entry: #{s}" #session[:logentry] = 0 unless session[:logentry] # Cache'll loop :D # cached = Rails.cache.read('logs_last') # if cached # s = cached.to_i # logger.debug "cached entry #{s}" # else # Rails.cache.write('logs_last', s) # end a = false if session[:logentry] logger.debug "Session entry #{session[:logentry]}" if s != session[:logentry] session[:logentry] = s logger.debug "New session entry #{session[:logentry]}" a = true end else session[:logentry] = s logger.debug "New session entry #{session[:logentry]}" a = true end # TODO: Only refresh activescaffold instead? render :nothing => true unless a end def conditions_for_collection s = Logsession.find(:last) ['logsession_id = (?)', s] if s end end
Version data entries
8 entries across 8 versions & 1 rubygems