How extend model attributes?

How do I add arbitrary attributes to an AR model?

It would appear that simply adding instance vars with accessors to an
AR model doesn’t actually work the same way as a regular class. Quite
confused by that.

The attributes derived by reflection is fine, but I have several
other attributes that will not come from the data table. Most are
state vars or behavior modification vars derived from config settings
or application logic. These + the data table combine to make up the
whole model.

– gw

On Nov 1, 2007, at 4:18 PM, Greg W. wrote:

whole model.
Hmm, well after untold permutations, I finally struck upon the
combination that works.

– gw

attr_accessor :name

Basically sets up a getter setter for the attribute so you can do
self.name= and self.name.