Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
rails_admin_sort_embedded
Advanced tools
Sort for Embedded documents in mongoid. Field order is need.
Bonus features:
cover
and image
columnsAdd this line to your application's Gemfile:
gem 'rails_admin_sort_embedded'
And then execute:
$ bundle
Add the sort_embedded action for each model or only for models you need
RailsAdmin.config do |config|
config.actions do
......
sort_embedded do
visible do
%w(Page).include? bindings[:abstract_model].model_name
end
end
end
end
In embedded model:
field :order, type: Integer, default: 0
scope :sorted, -> { order_by([:order, :asc]) } #optional
or use https://github.com/ack43/rocket_cms and:
# generate 'order' field, 'sort' as alias and scopes 'ordered' and 'sorted'
include SortField
sort_field
or
# generate fields and scopes with prefix 'another_': 'another_order' field, 'another_sort' as alias and scopes 'another_ordered' and 'another_sorted'
include SortField
sort_field :another
In parent model:
embeds_many :method_name
rails_admin do ...
sort_embedded({
fields: [{model: [:order_field_1, :order_scope_1]}, {model: [:order_field_2, :order_scope_2]}...],
label_methods: [:name, :label],
toggle_fields: [:enabled],
thumbnail_fields: [:image, :cover],
thumbnail_size: :thumb,
thumbnail_gem: :paperclip, # or :carrierwave
})
end
You can not use '[:order_field_1, :order_scope_1]' and just use [:order_field_1]. Scope_name will be :order_field_1 as string + "ed" Default field is 'order', default scope is 'ordered';
I18n:
ru:
rails_admin:
sort_embedded:
my_news:
my_news_images: Фотогалерея
# or with specified fields
ru:
rails_admin:
sort_embedded:
my_news:
my_news_images:
order: Фотогалерея
another_order: Фотогалерея(alt)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Some ideas and code for this gem are taken from:
FAQs
Unknown package
We found that rails_admin_sort_embedded 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.