
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
administrate-field-nested_has_many
Advanced tools
A plugin for nested has_many forms in Administrate.
This gem depends on Administrate APIs that may change over time. For this reason, some versions of this gem will be compatible only with some versions of Administrate.
This is a table of known compatibilities. It is accurate to the best of our knowledge. Please let us know if you detect other incompatibilities:
nested_has_many | Administrate |
---|---|
v2.1.0 | v0.20.0 |
v2.0.0 | up to v0.19 |
v1.3.0 | up to v0.15 |
#726d8gc | from v0.16 |
master | up to v0.19.0 |
Add to your Gemfile
:
gem "administrate-field-nested_has_many"
Run:
$ bundle install
Add to your FooDashboard
:
ATTRIBUTE_TYPES = {
bars: Field::NestedHasMany.with_options(skip: :foo),
}
The skip
option takes a single symbol or list of symbols.
It will prevent the nested form from displaying the fields for those attributes.
If a Customer
has_many :orders
,
and you want to render orders
as a nested form on the customer edit page,
then it is generally necessary to add skip: :customer
to the options
for the NestedHasMany
field.
Otherwise, Administrate will try to render a field
for the order's :customer
attribute,
which breaks the nested form logic.
undefined method 'new_record?' for nil:NilClass
This field assumes that your models are setup for nested assignment as per
Rails conventions. For example, if you have a Recipe
that
has_many :ingredients
, you would have something like this:
class Recipe < ApplicationRecord
has_many :ingredients
accepts_nested_attributes_for(
:ingredients,
reject_if: :all_blank,
allow_destroy: true
)
end
Specifically, you'll see this new_record?
error if you forget the
accepts_nested_attributes_for
declaration.
FAQs
Unknown package
We found that administrate-field-nested_has_many demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.