Sha256: 86e78688d06109bc485446d6bb982760effbe80ea1d21b3767a6b11e29759347

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

Application.class_eval do
  helpers do
    
    def increment(attribute)
      if params[:variants] && variants = ABVariant.find_all_by_name(params[:variants])
        variants.each do |variant|
          variant.increment! attribute
        end
      end
      nil
    end
    
    def valid_token?
      Digest::SHA256.hexdigest(params[:session_id] + Token.cached) == params[:token]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
a_b-0.1.1 lib/a_b/helper/api.rb