Skip to content

Latest commit

 

History

History
41 lines (24 loc) · 766 Bytes

README.rdoc

File metadata and controls

41 lines (24 loc) · 766 Bytes

acts_as_featured

Feature your models on your site’s special spots.

(Tested only on Rails 2.3.2 as of now)

Setup

Install the plugin:

script/plugin install git://github.com/sgt/acts_as_featured.git Add the features table to your database:

script/generate acts_as_featured_migration rake db:migrate

Usage

In the model:

class Article < ActiveRecord::Base acts_as_featured end

Assigning models to feature spots:

article = Article.create(:subject=>‘foo’, :body=>‘bar’) # Assign the article to a feature spot (removes previous) article.feature_at! :top_right_spot

Getting the featured object:

@article = Article.featured_at :top_right_spot

Or directly in the view:

<% feature :top_spot do |f| %> <%= link_to f, f.name %> <% end %>