Use #presence when fetching field's value. #1387

merged 1 commit into from Nov 10, 2012


None yet
2 participants

saulius commented Nov 10, 2012


I encountered an exception when trying to display IPAddr field in show view. That happens because of IPAddr#<=> implementation (see

irb(main):006:0> ip ='')
=> #<IPAddr: IPv4:>
irb(main):007:0> ip != []
NoMethodError: undefined method `to_i' for []:Array
irb(main):008:0> ip != ''
ArgumentError: invalid address

I suspect there may be other classes (custom or in stdlib) that may be affected by this. ActiveSupport's #presence, based on #blank? seems to yield the expected result.


This comment has been minimized.

Show comment
Hide comment

sferik Nov 10, 2012


Thanks for the patch!


sferik commented Nov 10, 2012

Thanks for the patch!

sferik added a commit that referenced this pull request Nov 10, 2012

Merge pull request #1387 from sauliusg/patch1
Use #presence when fetching field's value.

@sferik sferik merged commit 92f7d80 into sferik:master Nov 10, 2012

1 check passed

default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment