Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
envoy-activerecord_pg_stuff
Advanced tools
Adds support for working with temporary tables and pivot tables (PostgreSQL only).
Add this line to your application's Gemfile:
gem 'activerecord_pg_stuff'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activerecord_pg_stuff
Example:
User.select(:id, :email).temporary_table do |rel|
rel.pluck(:id)
end
Before using, you need to create the extension:
CREATE EXTENSION tablefunc
Example:
CREATE TABLE payments (id integer, amount integer, seller_id integer, created_at timestamp)
INSERT INTO payments
VALUES (1, 1, 1, '2012-10-12 10:00 UTC'),
(2, 3, 1, '2012-11-12 10:00 UTC'),
(3, 5, 2, '2012-09-12 10:00 UTC'),
(4, 7, 2, '2012-10-12 10:00 UTC'),
(5, 11, 2, '2012-11-12 10:00 UTC'),
(6, 13, 2, '2012-11-12 10:00 UTC')
Payment
.select("SUM(amount) AS amount", :seller_id, "DATE_TRUNC('month', created_at) AS month")
.group("seller_id, DATE_TRUNC('month', created_at)")
.temporary_table do |rel|
# :month - for row
# :seller_id - for column
# :amount - for value
rel.pivot(:month, :seller_id, :amount)
end
expect(result.headers).to eq [nil, 1, 2]
expect(result.rows).to eq [
[ Time.utc(2012, 9, 1), nil, 5 ],
[ Time.utc(2012, 10, 1), 1, 7 ],
[ Time.utc(2012, 11, 1), 3, 24 ],
]
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that envoy-activerecord_pg_stuff 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.