Skip to content

Instantly share code, notes, and snippets.

@bernardobarreto
Created November 20, 2017 10:25
Show Gist options
  • Select an option

  • Save bernardobarreto/bcaf118787db527ea91a55549706a539 to your computer and use it in GitHub Desktop.

Select an option

Save bernardobarreto/bcaf118787db527ea91a55549706a539 to your computer and use it in GitHub Desktop.
bad practice application_controller example
class ApplicationController < ActionController::Base
before_action :increment_visits, only: [:index, :show, :new, :edit]
private
def increment_visits
current_user.inc(visits: 1) # Mongoid ODM example
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment