![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
lazy_columns is a Rails plugin that lets you specify columns to be loaded lazily in your Active Record models.
By default, Active Records loads all the columns in each model instance. This plugin lets you specify columns to be excluded by default. It is intended for scenarios where you have large attributes and don't want to load them in every operation because of performance.
Notice that a much better approach is moving those columns to new models, since Rails loads related models lazily by default. This plugin is an easy workaround.
In your Gemfile
gem 'lazy_columns'
Use lazy_load
in your Active Record models to define which column or columns should be loaded lazily:
class Action < ActiveRecord::Base
lazy_load :comments
attr_accessible :comments, :title
end
Now, when you fetch some action the comments are not loaded:
Action.create(title: "Some action", comments: "Some comments") # => <Action id: 1...>
action = Action.find(1) # => <Action id: 1, title: "Some action">
And if you try to read the comments
attribute it will be loaded into the model:
action.comments # => "Some comments"
action # => <Action id: 1, title: "Some action", comments: "Some comments"
This plugin does two things:
The first time you access a lazy attribute a new database query will be executed to load it. If you are going to operate on a number of objects and want to have the lazy attributes eagerly loaded use Active Record .select()
in the initial query. For example:
Action.select(:comments).all
FAQs
Unknown package
We found that lazy_columns demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.