Created
October 6, 2016 21:19
-
-
Save slawosz/2e3d8e0cef8d32218e0a665664c1b176 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# old rails | |
Model.find(:all, conditions: [...], order: "...") | |
default_scope | |
named_scope | |
# new rails | |
Model.where(..).order(..).where(..) | |
## | |
default_scope :conditions => "a=b" # default_scope lambda { where("a=b") } | |
class Model | |
# self == Model | |
default_scope lambda { where("a=b") } | |
# default_scope where("a=b") # => | |
# => default_scope <Relation:xyz> | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment