ActiveRecord transient fields?

Hi All,

Is it possible to have transient fields in a class that extends
ActiveRecord? If so how do I acheive it?

Thanks :slight_smile:

I think you’re asking if it’s possible to add attributes to AR-
derived classes. Yes:

class Person < ActiveRecord::Base
attr_accessor :my_transient_field

p =
p.my_transient_field = 1

the value of my_transient_field will not be stored in the database

Duane J.

Thanks Duane,

that was exactly what I was asking :slight_smile: