Fix Row#cell nil assignment bug #8

Merged
merged 1 commit into from Aug 18, 2012

Projects

None yet

3 participants

@paulspringett

Fixed bug where passed a nil value to Row#cell would be treated as though
there was no second value

@travisbot

This pull request passes (merged cd70ded into 13b138b).

@paulspringett paulspringett merged commit 63813cc into master Aug 18, 2012

1 check passed

Details default The Travis build passed
@brendon

Hey just had a thought, would this not still fail if the model has a column (say building_name) but we're also calculating that manually, and that calculation returns nil. This would mistakenly return the model's building_name instead of an empty string.

@paulspringett

@brendon I'm not going to take this issue any further.

The main use case for CSV Shaper is working with models. If you want to add cells manually you can create a row without a model using

csv.row do |csv|
  # no model issues here
end

Thanks you your help.

@brendon

Hi Paul, in my case I'm wanting to include columns from an associated model (sometimes the associated models column evaluates to nil). I guess provided I make sure that I don't chose a column name that matches an existing method on the model then all will be well :) I still think that using a block to calculate a manual cell value is more explicit and has less confusing edge cases. Though this would break backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment