Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   ActiveRecord transient fields? (http://www.velocityreviews.com/forums/t839248-activerecord-transient-fields.html)

PerfectDayToChaseTornados 03-21-2007 10:32 PM

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 :-)

--
pdtct



Duane Johnson 03-21-2007 10:51 PM

Re: ActiveRecord transient fields?
 
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
end

p = Person.new
p.my_transient_field = 1
# the value of my_transient_field will not be stored in the database

Duane Johnson
http://blog.inquirylabs.com/

On Mar 21, 2007, at 4:35 PM, PerfectDayToChaseTornados wrote:

> Hi All,
>
> Is it possible to have transient fields in a class that extends
> ActiveRecord? If so how do I acheive it?
>
> Thanks :-)
>
> --
> pdtct
>
>
>




PerfectDayToChaseTornados 03-22-2007 08:13 AM

Re: ActiveRecord transient fields?
 
Thanks Duane,

that was exactly what I was asking :-)

--
pdtct




All times are GMT. The time now is 12:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.