scope methods rails code example
Example: rails scopes
class Book < ApplicationRecord
scope :costs_more_than, ->(amount) { where("price > ?", amount) }
end
class Book < ApplicationRecord
scope :costs_more_than, ->(amount) { where("price > ?", amount) }
end