
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
USearch provides some useful model scopes/methods to search data on rails active record
.
Inside your Gemfile add the following:
gem 'usearch', '~> 0.1.1'
search all scope
:Include the concern in the model you want tu use the scope:
include Usearch::SearchAllScope
then you can use the search_all_scope_fields
method to specify the fields you want to include in your query, search_all_scope_fields
should include existent attributes for the model.
search_all_scope_fields :field_one, field_two, ...
it also accepts fields from joined tables, we can achieve that using an array with the name of the joined table as first element and the name of the field as second, example:
search_all_scope_fields :field_one, :field_two, [:joined_table_name, :joined_table_field_name],
[:joined_table_name, :joined_table_field_name] ...
Then you can use the scope for the model:
ModelName.search_all(query: 'a string value')
full example:
class User < ApplicationRecord
include Usearch::SearchAllScopeConcern
has_one :address
search_all_scope_fields :name, :last_name, [:address, :city]
end
In that example if we use User.search_all(query: 'james')
it will return all the records that have a concidence with the word james
, checking in users.name
, users.last_name
and adresses.city
.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/carlosm02635/usearch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Usearch project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that usearch 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
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
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.