
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Add this line to your application's Gemfile:
gem 'mongoid_rating'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mongoid_rating
make model rateable:
class Post
include Mongoid::Document
rateable :rate
# needed if you use rails_admin so it would not complain
accepts_nested_attributes_for :rate_data
end
ps = Post.create()
user = User.create()
rate and unrate:
ps.rate 5, user
ps.unrate, user
Get current rating
ps.rate
=> 5.0
ps.rate_by(user)
=> 5
Check if user rated:
ps.rate_by?(user)
=> true
Scopes:
Post.highest_rate
Post.rate_in(2..5)
Post.rate_in(2..5).first
=> #<Post rate_count: 1, rate_sum: 5.0, rate_average: 5.0>
Post.rate_in(2..3).first
=> nil
Posts rated by user:
Post.rate_by(user).first
=> #<Post rate_count: 1, rate_sum: 5.0, rate_average: 5.0>
(c) 2013 glebtv, MIT license
Partially based on mongoid-rateable which is Copyright (c) 2011 Peter Savichev (proton), MIT license
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that mongoid_rating 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.