You are here: Browse Railsplugins Acts As Most Popular
Make your models feel like they are in high school again. This plugin retrieves the most frequently occurring values for each column. It adds methods of the form most_popular_pluralized_column_name. You can control how many results you get with the :limit option. The default limit is 5.
class Exercise < ActiveRecord::Base acts_as_most_popular end
class YourController < ActionController::Base def index @popular_exercises = Exercise.most_popular_names end end
The most_popular_* methods take plural column names. Take a look at the tests for more examples.
Create a database named most_popular_test or change the database name in database.yml in the plugin folder. Navigate to the plugin folder and run rake.
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly