hidden features in activerecord and the future
TRANSCRIPT
![Page 1: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/1.jpg)
THE HIDDEN FEATURES OF
ACTIVE-RECORDAnd the Future…..
- Tejas Bubane
@tejasbubane
![Page 2: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/2.jpg)
1. ENUMS 2. OPTIMISTIC LOCKING
3. DIRTY TRACKINGAnd the Future of course….
![Page 3: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/3.jpg)
ENUMS
![Page 4: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/4.jpg)
ENUMS
![Page 5: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/5.jpg)
LOCKING
1. Optimistic Locking - Application Level
2. Pessimistic Locking - Database Level
![Page 6: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/6.jpg)
OPTIMISTIC LOCKING
![Page 7: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/7.jpg)
DIRTY TRACKINGActiveModel::Dirty tracks changes in a Model
![Page 8: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/8.jpg)
DIRTY TRACKING
![Page 9: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/9.jpg)
FUTURE
Rails 5 !!! 🎉
![Page 10: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/10.jpg)
#OR OPERATOR
PR: https://github.com/rails/rails/pull/16052
Post.where(title: "Tuesday Talk").or(Post.where(title: "Wednesday Talk")
![Page 11: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/11.jpg)
#HAS_SECURE_TOKENSimilar to #has_secure_password
PR: https://github.com/rails/rails/pull/18217
![Page 12: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/12.jpg)
#BELONGS_TO REQUIREDSimilar to #has_secure_password
PR: https://github.com/rails/rails/pull/18937
![Page 13: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/13.jpg)
QUESTIONS ?
![Page 14: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/14.jpg)
REFERENCES1. ENUM: http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html
2. Optimistic Locking: http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
3. Dirty Tracking: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html
4. Future Rails 5: https://medium.com/evil-martians/the-rails-5-post-9c76dbac8fc
![Page 15: Hidden features in ActiveRecord and the future](https://reader031.vdocuments.mx/reader031/viewer/2022022415/5a65a9f67f8b9aa4758b571b/html5/thumbnails/15.jpg)
THANK YOU 😊