Want to share a new gem for lazy-loading specified Active Record columns - GitHub - fatkodima/activerecord_lazy_columns: Adds support for lazy-loading columns in Active Record models
This can greatly reduce IO and improve queries (and application’s) performance if you have some large db columns that are not used most of the time.
Sample usage:
class Action < ApplicationRecord
lazy_columns :comments
end
Action.create!(title: "Some action", comments: "Some comments") # => <Action id: 1...>
action = Action.find(1) # => <Action id: 1, title: "Some action">
action.comments # => "Some comments"
action # => <Action id: 1, title: "Some action", comments: "Some comments">