3

Can you explain a "transient attribute" in Ruby on Rails?

I'm reading the factory_girl Getting Started guide and its making reference to transient attributes. [https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#defining-factories][1]

I understand "attribute" as an instance variables. But "transient attribute" vs. "attribute"; not so sure.

I'm new to Ruby on Rails and this would be helpful.

tim_xyz
  • 11,573
  • 17
  • 52
  • 97
  • 2
    A transient attribute does not get persisted to the database. For instance, in one of my models, I have a transient attribute called last_updated_by. I don't save it to the database; I just use it during the processing of the model object by the controller. – J Plato Aug 28 '15 at 15:03

1 Answers1

7

"A transient attribute does not get persisted to the database. For instance, in one of my models, I have a transient attribute called last_updated_by. I don't save it to the database; I just use it during the processing of the model object by the controller."

Thanks J Plato!

tim_xyz
  • 11,573
  • 17
  • 52
  • 97