Created
February 1, 2009 11:19
-
-
Save ccjr/55851 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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