
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
This gem provides several methods to fetch random records from database.
To run tests, first, please create and fill with correct values these configuration files:
You could find configuration examples into ./spec/db directory. Then you need to create these databases by internal rake task for each database:
ADAPTER=sqlite bundle exec rake test:db:migrate
ADAPTER=postgresql bundle exec rake test:db:migrate
ADAPTER=mysql bundle exec rake test:db:migrate
The you could run them and check that all is fine:
$ rspec spec/
Add this line to your application's Gemfile:
gem 'rand-orders'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rand-orders
# It will work for any ActiveRecord inherited class:
( For example, this model has 'amount' integer field)
class Item < ActiveRecord::Base; end
# Let's get some records ordered randomly:
Item.random
# Or get some random records with field value between 2 and 5:
# (This is the same as: Item.where("amount > 2 AND amount < 5").random)
Item.random_in_range(:amount, (2..5)) #
# Also we can fetch from database only the fields equal to some value:
# (This is the same as: Item.where(:amount => 1).random)
Item.random_equal(:amount, 1)
# If we want to get values only from one of fields, use 'select_random' method:
# (This is the same as: Item.random.pluck(:amount))
Item.select_random(:amount)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that rand-orders 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
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.