Answers for "rails scope where"

1

rails scopes

class Book < ApplicationRecord
  scope :costs_more_than, ->(amount) { where("price > ?", amount) }
end
Posted by: Guest on April-21-2021
0

rails scope where not

scope :scope_name, -> { where.not(target: 'value')) }
Posted by: Guest on October-29-2021

Browse Popular Code Answers by Language