Closed dynamicworkplace closed 9 years ago
@dynamicworkplace could you provide a sample app with this issue?
I've investigated this further and the activator is working and toggles the boolean data, however the display isn't refreshing to Yes/No - other fields are redisplaying correctly after being updated.
I can confirm the same issue, the Yes/No values are not being updated after a successful change. Clicking on Yes or No updates the database, however the text remains the same.
Model: PendingInvite approved: boolean
view: <%= best_in_place pending_invite, :approved, as: :checkbox %>
controller:
def update @pending_invite = PendingInvite.find(params[:id]) respond_to do |format| if @pending_invite.update(pending_invite_params) format.html { redirect_to @pending_invite, notice: 'Pending invite was successfully updated.' } format.json { respond_with_bip(@pending_invite) } else format.html { render :edit } format.json { respond_with_bip(@pending_invite) } end end end
I tried using a display_with method and this will display the data correctly after an update, though it doesn't use the method when the data is first displayed.
@stevobengtson @dynamicworkplace are you using the latest version from github?
Using best_in_place 3.0.3 from https://github.com/bernat/best_in_place.git (at master)
@dynamicworkplace make a sample repo with this bug and I will try to check it
@stereodenis I have set up a test repository that duplicates the issue, and have come across something helpful.
https://github.com/stevobengtson/bip_test
In this test navigate to http://localhost:3000/inventories I have added bip to the table. Clicking on entries in the used column will update the data but not update the display (refresh page to see changes), however clicking on the stored column will update the display instantly (no refresh required).
The difference is that Used is setup with the default "No", "Yes" collection, where as the Stored is setup with the hash syntax { false: "No", true: "Yes"}. So it looks like when the collection is an array it fails to update.
Using the select with an array collection (see Location) works as expected.
Hope this helps :).
Thanks @stevobengtson , changing my collection from collection: %w[No Yes] %
to collection: { false: "No", true: "Yes"}
fixed the issue for me.
Rails 4.2.1, best_in_place 3.0.3
I'm having problems with the activator not working for checkboxes - it works for other field types.
I'd be grateful for your advice on whether this is an issue in this version, or help diagnosing the fault.
Thank you