-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
we have this documentation internally in our README.
Empty Cells Implying Previous Cell
Suppose you have a table like thus:
| id | name |
|---|---|
| 1 | a |
| * | b |
where * is an empty cell, but it really implies “1”, the previous id.
You can memoize and point to the previous cell:
class ProjectImportRow
def id
# `#previous` is from `csv_row_model`
# memoize because `previous.previous` is always `nil`, otherwise `csv_row_model` creates a linked list
@id ||= original_attribute(:id) || previous.try(:id)
end
endwant to implement this with a :carry_forward, :or_previous, :take_previous option---I'm open to other words.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels