
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
acts_as_mongo_rateable
Advanced tools
Inspired by the old Rails+AR standby "acts_as_rateable," this rating plugin works with MongoDB+MongoMapper and has weighted ratings, as well as bayesian and straight averages, and some friendly class-level helpers.
Intends to be super-performant by taking advantage of the benefits of document-driven db denormalization.
Install the plugin:
./script/plugin install git://github.com/mepatterson/acts_as_mongo_rateable.git
Add the following 2 lines to the Model class that you want to make rateable:
include ActsAsMongoRateable
RATING_RANGE = (1..5)
Obviously, change the rating range if you want to rate on a 10-star system or a 14-star or whatever.
class User
include MongoMapper::Document
end
class Widget
include ActsAsMongoRateable
RATING_RANGE = (1..5)
include MongoMapper::Document
end
widget = Widget.first
To rate it:
widget.rate(score, user, weight)
Now try all these fun methods:
widget.average_rating
widget.bayesian_rating
widget.rating_stats
And some useful class methods:
Widget.highest_rated(how_many)
Widget.most_rated(how_many)
Widget.most_rated_by_authorities(how_many)
Widget.highest_bayesian_rated(how_many)
('how_many' is a limit and is optional. i.e. Do you want a highest_rated list of 5, 10, 15 widgets?
Defaults to just 1 if you don't pass any argument.)
Copyright (c) 2009 [M. E. Patterson], released under the MIT license
FAQs
Unknown package
We found that acts_as_mongo_rateable 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.