Ruby on Rails Friday, January 31, 2014

Here is the counters_controller.rb code : 

class CountersController < ApplicationController
  #require 'colorize'

  before_action :get_counter, only: [:show, :edit, :update, :destroy]

  # GET /counters
  # GET /counters.json
  def index
  end

  # GET /counters/1
  # GET /counters/1.json
  def show

    raw_counter = REDIS.hget(params[:id], 'c')
    raw_counter_reset = REDIS.hget(params[:id], 'overquota_reset_c')
    raw_counter_reset_date = REDIS.hget(params[:id], 'overquota_reset_at')
    #@counter_max = 'put'.red
    #@counter_msg.red
    @counter = {:id => params[:id]}
    if raw_counter == '0'
      @counter_msg = '0'
      @counter_max = '0'
    else
      @counter_msg = raw_counter[9..17]
      @counter_max = raw_counter[1..6]

      #if @counter_msg > @counter_max

     

No comments:

Post a Comment