bernat/best_in_place — Issue #59: Collection select with nil value
Author: cbanke1
Created: 2011-12-16 17:48:45+00:00
State: open

This issue was raised previously (https://github.com/bernat/best_in_place/issues/6), but there was no answer, at least none that fixed my problem. I am using bip with decorators (draper), so where you see `model`, that is the correct syntax. When I tried
````
best_in_place(model, :hospital_id, type: :selection, collection: Hospital.all.collect {|h| [h.id, h.name]}, nil: 'Click to add a hospital')
````
that did not seem to work. I then tried
````
best_in_place(model, :hospital_id, type: :selection, collection: ['', "Click to add a hospital"] + Hospital.all.collect {|h| [h.id, h.name]})
````
which also did not work. When a user has a nil hospital_id, instead of displaying the "click to add hospital", it displays nothing, and is not clickable.