Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
ActiveRecord transient fields?
PerfectDayToChaseTornados
3/21/2007 10:32:00 PM
Hi All,
Is it possible to have transient fields in a class that extends
ActiveRecord? If so how do I acheive it?
Thanks :-)
--
pdtct
2 Answers
Duane Johnson
3/21/2007 10:52:00 PM
0
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.inquir...
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
3/22/2007 8:14:00 AM
0
Thanks Duane,
that was exactly what I was asking :-)
--
pdtct
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
ActiveRecord transient fields?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password