Search code examples
ruby-on-railsbest-in-place

display text best_in_place gem


I'm using the best_in_place gem for in place editing. I have this around a link that I want editable, but what's displayed to the user should be "Edit Link".I want to be able to edit the link when this field is clicked on, but I want what's displayed to the user (the anchor text) to be "edit link". I tried using "display_with" and "value" but neither has worked.

It's currently displaying the value of the database field which is the URL: https://plus.google.com/+SteveQuatrani/posts

<%= best_in_place c, :google_maps_url, value: "Edit Link" %>

Is there a way to do this? Thank you in advance for your help!


Solution

  • display_with requires a helper or proc, so try giving it one:

    <%= best_in_place c, :google_maps_url, display_with: Proc.new {"Edit Link"} %>