unpopulated in_place_editor_field not working

Mike Dershowitz wrote:

Hi:

I have a show page with an in place editor field for description. It
works great when description is populated. description can be nil, so I
notice that when I show a record with no description, the in place
editor either doesn't work or has no place to click to edit. This is
still something i'd like to have work. Is there something additional I
have to do for when description isn't populated?

from the view:

  <b>Description:</b>
  <%= in_place_editor_field :goal, :description %>
  </p>

Thanks so much in advance!

Mike

--
Posted via http://www.ruby-forum.com/.

use the :external_control option on the in_place_editor_field

its the easiest way.

Any further sugestions besides setting the default value in the DB to
“Add a description here” as the other poster suggests?

I sure wish someone could answer this question. I have been poking around and don’t see anything that explains the syntax of the in_place_editor_options well enough that I can make this work. One thing that I wasted a bunch of time on was the :click_to_edit_text - that isn’t what Mike and I want. Instead it is supposed to change the tooltip text when you mouse over the text to edit.

Is there a way for me to create a non-database backed attribute for the fake text? and then still have the real attribute edited? It doesn’t look like that is easy to do the way the In Place Editor API is set up.

More searching turned up a post to this list referencing:
    http://www.akuaku.org/archives/2006/08/in_place_editor_1.shtml

I dropped it in, restarted my server, and then started using it. For
other newbies, that involved changing the controller line to add the
:empty_text parameter:
    in_place_edit_for :page, :comments, :empty_text => '(add comment)'
And changing my invocation of in_place_editor_field to include the
in_place_editor_options hash:
    <%= in_place_editor_field :page, :comments, {}, {
:nil_content_replacement => '(add comment)' } %>

Its working for me with Integers and Strings, but I get an error on
Float fields. It says
Undefined method `size' for 0.03:Float

It does change the value in the database though...

ah, you are right. template missing error. value is updated in the
database.