Created
April 9, 2023 13:59
-
-
Save salvadorgascon/ac9f2af8de70b0f69396fb876b73cd84 to your computer and use it in GitHub Desktop.
Concern to add a scope into a model in Ruby on Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ContainsName | |
extend ActiveSupport::Concern | |
included do | |
# Scope definition here | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model < ApplicationRecord | |
include ContainsName | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment