Answers for "how to write a scope in rails"

1

rails scopes

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

how to write a scope in rails

scope :proponent,   ->(user){ where(user_id: user.id) }
Posted by: Guest on August-12-2021

Code answers related to "how to write a scope in rails"

Code answers related to "Javascript"

Browse Popular Code Answers by Language