-
Review of Rails Scopes & Namespacing
namespace :admin do resources :reviews, only: [:index] end
which is synonomous with...
scope '/admin', as: 'admin' do resources :reviews, only: [:index] end
-
Refresher on query modifiers *
offset
andlimit
*order
*distinct
*group
*group(...).having(...)
-
Scopes * named scopes with lambda blocks * Lambda blocks are anonymous methods * scope chaining * default scope *
unscope
/unscoped
/reorder
-> Remove parts of a scope when needed -
Shortcuts
Model.find_or_create_by
Model.find_or_initialize_by
(=Model.find
+Model.new
)
Created
March 31, 2016 16:39
-
-
Save FaisalAl-Tameemi/481709b856eee85912439902824d63a0 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment