
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
RecordTagHelper consists of code that was formerly a part of ActionView
, but has been removed from core in Rails 5. This gem is provided to ensure projects that use functionality from ActionView::Helpers::RecordTagHelper
have an appropriate upgrade path.
This gem provides methods for generating container tags, such as div
, for your record. This is the recommended way of creating a container for your Active Record object, as it adds appropriate class and id attributes to that container. You can then refer to those containers easily by following that convention, instead of having to think about which class or id attribute you should use.
Simply add gem 'record_tag_helper', '~> 1.0'
to your Gemfile and run bundle install
.
content_tag_for
Renders a container tag that relates to your Active Record Object.
For example, given @article
is an object of type Article
, you can do:
<%= content_tag_for(:tr, @article) do %>
<td><%= @article.title %></td>
<% end %>
This will generate this HTML output:
<tr id="article_1234" class="article">
<td>Hello World!</td>
</tr>
You can also supply HTML attributes as an additional option hash. For example:
<%= content_tag_for(:tr, @article, class: "frontpage") do %>
<td><%= @article.title %></td>
<% end %>
Will generate this HTML output:
<tr id="article_1234" class="article frontpage">
<td>Hello World!</td>
</tr>
You can pass a collection of Active Record objects. This method will loop through your objects and create a container for each of them. For example, given @articles
is an array of two Article
objects:
<%= content_tag_for(:tr, @articles) do |article| %>
<td><%= article.title %></td>
<% end %>
Will generate this HTML output:
<tr id="article_1234" class="article">
<td>Hello World!</td>
</tr>
<tr id="article_1235" class="article">
<td>Ruby on Rails Rocks!</td>
</tr>
div_for
This is actually a convenient method which calls content_tag_for
internally with :div
as the tag name. You can pass either an Active Record object or a collection of objects. For example:
<%= div_for(@article, class: "frontpage") do %>
<td><%= @article.title %></td>
<% end %>
Will generate this HTML output:
<div id="article_1234" class="article frontpage">
<td>Hello World!</td>
</div>
FAQs
Unknown package
We found that record_tag_helper 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.