how to ad a "virtual column" to a model

Remco Hh wrote:

is it possible to define a column in a model, which is not present in
the table? this column should return a combination of two other columns.

Model.columnC=Model.columnA+"-"+Model.columnB

A and B are in the table, C isn't

If you just want to grab this value, you just need a standard Ruby
method in your model definition:

def columnC
  columnA + "-" + columnB
end

If you want to be able to write to this attribute as well, then you'll
have to write a method along the lines of

def columnC=(new_value)
  columnA, columnB = new_value.split("-")
  new_value
end

although obviously there is some ambiguity with "strings-like-this".

Hope that helps,
Chris