Skip to content
Permalink
Browse files

Named scopes

  • Loading branch information
ImsirovicAjdin committed Dec 26, 2019
1 parent 7b770a8 commit 0782e910057849fde50b0ec6d819465d31c21215
Showing with 5 additions and 0 deletions.
  1. +5 −0 app/models/movie.rb
@@ -1,2 +1,7 @@
class Movie < ApplicationRecord
# self.primary_key = 'id'

scope :from_newest, lambda { order("created_at DESC") }
scope :lookup, lambda {|titlestring| where(["title LIKE ?", "%#{titlestring}%"]) }

end

0 comments on commit 0782e91

Please sign in to comment.
You can’t perform that action at this time.