Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Subject < ActiveRecord::Base
- has_one :page
- scope :newest_first , lambda {order("subjects.created_at DESC")}
- scope :search, lambda{|query|
- where(["name LIKE?","%#{query}%"])
- }
- scope :visible ,lambda{ where(visible: true) }
- scope :invisible, lambda{ where(visible: false) }
- scope :sorted ,lambda{ where ("subjects.position ASC")}
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement