Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails scopes

class Book < ApplicationRecord
  scope :costs_more_than, ->(amount) { where("price > ?", amount) }
end
Source by guides.rubyonrails.org #
 
PREVIOUS NEXT
Tagged: #rails #scopes
ADD COMMENT
Topic
Name
4+2 =