
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Arrangeable provides an organized and seamless way to sort your ActiveRecord objects by different attributes.
Add this line to your application's Gemfile:
gem 'arrangeable', '~> 0.1.5'
And then execute:
$ bundle
Or install it yourself as:
$ gem install arrangeable
Include Arrangeable inside ApplicationRecord or directly inside your ActiveRecord model and override the arrangeable_fields
method for each model to whitelist the fields you want to use for sorting:
class User < ApplicationRecord
include Arrangeable
concerning :Arranging do
class_methods do
def arrangeable_fields
%w[id first_name last_name]
end
end
end
end
Failing to override arrangeable_fields
will raise a NotImplementedError
.
Now sort your objects by calling arrange
on your model and passing a comma-separated order string. Prepend a negative sign -
before a key to order by that key descendingly:
@users = User.all
order_string = 'first_name,-id'
@users = @users.arrange(order_string)
The previous example will generate the following SQL order clause: ORDER BY first_name ASC, id DESC
.
Note that id
can always be used for sorting regardless of whether you whitelist it or not. Any non whitelisted sorting keys will be ignored.
Bug reports and pull requests are welcome on GitHub at https://github.com/umar221b/arrangeable.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that arrangeable 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
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
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.