0

Is it possible to set up something you could call a "fake property" in a DataMapper model? What I mean is, a property that isn't persisted, but that is still modifiable using create() or update(). Instead of persisting the data in the data store, a function would be called instead with the value.

user1499207
  • 305
  • 1
  • 4
  • 7

2 Answers2

0

Turns out that create() and update() do nothing more than self.property = value.

user1499207
  • 305
  • 1
  • 4
  • 7
0

Use attr_accessor in your model like this:

class Account
  include DataMapper::Resource
  attr_accessor :password
end

The method is explained here what is attr_accessor in datamapper - ruby

Community
  • 1
  • 1
ujifgc
  • 2,215
  • 2
  • 19
  • 21