Ruby on Rails reselect and rewhere lets you optimize performance
Muhammad Hussain
Posted on June 28, 2024
Enhance your Rails queries with ActiveRecord's reselect
and rewhere
methods!
-
reselect
: Streamline your data retrieval by dynamically adjusting the SELECT clause in your queries. Instead of rewriting entire queries, reselect lets you optimize performance by selecting only the necessary columns. Perfect for efficient data fetching and cleaner code!. likePost.where(category:'Technology').reselect(:title, :created_at)
-
rewhere
: Modify existing WHERE clauses on-the-fly without starting from scratch. Whether adapting filter criteria or handling dynamic data conditions,rewhere
empowers developers to build adaptable queries for dynamic data filtering and efficient querying. likeUser.where(active: true).rewhere(last_login_date: Date.today - 7.days)
💖 💪 🙅 🚩
Muhammad Hussain
Posted on June 28, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.