
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Adds (native) UUID support, including support for primary keys and associations , to your ActiveRecord models. Currently only supports PostgreSQL.
Inspired by https://github.com/jashmenn/activeuuid and the lack of PostgreSQL gems that worked.
Add this to your Gemfile
:
gem "uuid"
gem "acts_as_uuid"
You can now set the type uuid
for an attribute in your models.
NB: We don't depend on uuid gem because you can use any gem that provides UUID.generate
, such as the cuuid gem.
class AddUUIDPrimaryKeyToEmail < ActiveRecord::Migration
def self.change
create_table :emails, :id => false do |t|
t.uuid :id, :unique => true
end
add_index :emails, :id
end
end
Don't forget: You will also need to change any foreign keys to the uuid
type.
For existing models just add:
class AddUUIDPrimaryKeyToEmail < ActiveRecord::Migration
def self.change
remove_column :emails, :id
add_column :emails, :id, :uuid
add_index :emails, :id
end
end
Keep in mind: after this all your UUIDs will be set to nil.
class Email < ActiveRecord::Base
include ActsAsUUID
uuid_on :id, :as => :primary_key
end
class AddUUIDPrimaryKeyToEmail < ActiveRecord::Migration
def self.change
add_column :emails, :guid, :uuid
add_index :emails, :guid, :unique => true
end
end
Keep in mind: after this all your UUIDs will be set to nil.
class Email < ActiveRecord::Base
include ActsAsUUID
uuid_on :guid
end
.first
, .find_each
and .find_in_batches
. Basically any method that requires the ID to be sorted as an integer.See LICENSE
FAQs
Unknown package
We found that acts_as_uuid 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.