Sha256: 5e0fe4bec3a189f974d39925dd7a9f821ea832bd403f80713872d24b70cea3fb

Contents?: true

Size: 447 Bytes

Versions: 6

Compression:

Stored size: 447 Bytes

Contents

# A stupid little controller showing how easy you can build generic "counter" functionality
# when they're represented as a model
class CountersController < ApplicationController
  # Reset a counter to 0
  def destroy
    Counter::Value.find(params[:id]).reset!

    redirect_back fallback_location: "/"
  end

  # Recalculate a counter
  def update
    Counter::Value.find(params[:id]).recalc!

    redirect_back fallback_location: "/"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
counterwise-0.1.5 app/controllers/counters_controller.rb
counterwise-0.1.4 app/controllers/counters_controller.rb
counterwise-0.1.3 app/controllers/counters_controller.rb
counterwise-0.1.2 app/controllers/counters_controller.rb
counterwise-0.1.1 app/controllers/counters_controller.rb
counterwise-0.1.0 app/controllers/counters_controller.rb