My colleague and I have been working on a project for a client in the real estate industry. The product we're creating is a Rails app that tracks apartment listings, and one of the key features is that our client's agents must be able to create and edit "specials" that modify the prices of existing listings. There are many different types of specials: those that simply award a credit upon move-in; those that are relative to the rent of the property, such as one month free; and those that only apply during a particular date range, either for the signing of the lease or for the actual move-in date.
Any given special can apply to any number of matching listings, but any given listing can only have one special. We want to be able to retrieve the special linked to a particular listing quickly and easily, so this leads to a pretty straightforward association:
class Property < ActiveRecord::Base
belongs_to :special
end