I want to add to an existing model some attributes that need not be persisted, or even mapped to a database column. Is there a solution to specify such thing ?
Of course use good old ruby's attr_accessor. In your model:
attr_accessor
attr_accessor :foo, :bar
You'll be able to do:
object.foo = 'baz' object.foo #=> 'baz'
2.1m questions
2.1m answers
60 comments
57.0k users