Skip to content

Instantly share code, notes, and snippets.

@ccjr
Created February 1, 2009 11:19
Show Gist options
  • Save ccjr/55851 to your computer and use it in GitHub Desktop.
Save ccjr/55851 to your computer and use it in GitHub Desktop.
# Use the plugin in your model
class Video < ActiveRecord::Base
acts_as_featurable
end
# Call the feature! method to feature an object.
v = Video.find :first
v.feature!
v.featured? => true
# Models are featured for 1 month by default, but you can pass arguments to the feature! method to change the default behavior.
v.feature! 3.weeks.from_now
v.featured? => true
#The Video class also gets a new method called find_featured that you can use to find the featured objects.
Video.find_featured :first => # Video id: 18, title: "title" ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment