Skip to content

Instantly share code, notes, and snippets.

@salvadorgascon
Created April 9, 2023 13:59
Show Gist options
  • Save salvadorgascon/ac9f2af8de70b0f69396fb876b73cd84 to your computer and use it in GitHub Desktop.
Save salvadorgascon/ac9f2af8de70b0f69396fb876b73cd84 to your computer and use it in GitHub Desktop.
Concern to add a scope into a model in Ruby on Rails
module ContainsName
extend ActiveSupport::Concern
included do
# Scope definition here
end
end
class Model < ApplicationRecord
include ContainsName
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment