Problem:
- wants to copy fields from one model instance to other many times
fast (1000 instances at once).
Simplest solution would be abusing `values` hash, but I also want to
keep `changed_columns` tracking.
Currenlty I solve it by copying `[]=` method without calling
`typecast_value`:
module Sequel
class Model
def set_wo_typecast(column, value)
if new? || [email protected]?(column) || value != (c =
@values[column]) || value.class != c.class
changed_columns << column unless changed_columns.include?
(column)
@values[column] = value
end
end
end
end
Perhaps it is good candidate to be a standard method (maybe with
different name). What do you think?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.