# Problem with in\_place\_editor\_field

**URL:** <https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046>\
**Category:** Rails\
**Created:** [March 27, 2008, 1:42am UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046 "2008-03-27T01:42:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 1:42am UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/1 "2008-03-27T01:42:58Z")

</div>

ok, I am really pulling my hair out here over something that should be  
simple.

(Rails2, In\_place\_editor plugin)

In my index.html.erb, I have:

 \<% @tasks.each do |root| %\> - \<%= render(:partial =\> "task\_node", :object =\> root) %\>
 \<% end %\>

In my \_task\_node.html.erb, I have:  
\<%= in\_place\_editor\_field task\_node, ‘description’ %\>

\<% task\_node.children.each do |child| %\> - \<%= render(:partial =\> "task\_node", :object =\> root) %\>
\<% end %\>

I get an error which is  
“Called id for nil, which would mistakenly be 4…”

(error comes from line 73 of in\_place\_macros\_helper)

I am using this in the “normal” way successfully elsewhere in my  
project.

Thanks in advance before I go bald,

Alan

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 2:58pm UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/2 "2008-03-27T14:58:21Z")

</div>

Mikel,  
It is in the code. I got lazy with cut and paste trying to give a  
simpler example. Good catch, though!

–Alan

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 4:28am UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/3 "2008-03-27T04:28:18Z")

</div>

On Thu, Mar 27, 2008 at 11:42 AM, Alan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I get an error which is  
> “Called id for nil, which would mistakenly be 4…”

\<% task\_node.children.each do |child| %\> \> - \<%= render(:partial =\> "task\_node", :object =\> root) %\>
\>\<% end %\>

Shouldn’t that be :object =\> child ?

Mikel

> **[Mikel Lindsaar](https://lindsaar.net/)**
>
> Internet Home for Mikel Lindsaar

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 3:22pm UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/4 "2008-03-27T15:22:20Z")

</div>

On 27 Mar 2008, at 00:42, Alan S. wrote:

> \<% end %\>
> 
> In my \_task\_node.html.erb, I have:  
> \<%= in\_place\_editor\_field task\_node, ‘description’ %\>

in\_place\_editor\_field is one of the old school helper so it’s  
expecting the first parameter to be the name of an instance variable.  
A quick and dirty fix would be to put \<% @task\_node = task\_node %\> on  
the line above and change it to  
\<%= in\_place\_editor\_field ‘task\_node’, ‘description’ %\>

Fred

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 4:16pm UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/5 "2008-03-27T16:16:49Z")

</div>

On 27 Mar 2008, at 14:49, Alan S. wrote:

> Well, this gets me part of the way there. (although I have to admit,  
> I don’t understand why.)

it looks like you;ve still got \<%= in\_place\_editor\_field task\_node,  
‘description’ %\> in your form instead of \<%= in\_place\_editor\_field  
‘task\_node’, ‘description’ %\>

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 3:50pm UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/6 "2008-03-27T15:50:30Z")

</div>

Well, this gets me part of the way there. (although I have to admit,  
I don’t understand why.)

However, the HTML generated is:  
  
//\<![CDATA[new Ajax.InPlaceEditor('#\_description\_4\_in\_place\_editor', '/tasks/set\_%23%3CTask:0x2b2d504701f0%3E\_description/4', {callback:function(form) { return Form.serialize(form) + '&authenticity\_token=' + encodeURIComponent('de08c07c32d0105cd81841fc23d2b1ef4d4ea89f') }}) //]]\>

Why doesn’t it put the current value of the description in between the  
span tags? (since there is no place to click, it isn’t very  
helpful…)

Thanks in advance,

Alan

On Thu, Mar 27, 2008 at 9:21 AM, Frederick C.

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [March 27, 2008, 4:25pm UTC](https://www.ruby-forum.com/t/problem-with-in-place-editor-field/133046/7 "2008-03-27T16:25:08Z")

</div>

Thanks, that did it!

–Alan

On Thu, Mar 27, 2008 at 10:15 AM, Frederick C.
